aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Checking whether the date entered within textfield does comply with the format given Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checking whether the date entered within textfield does comply with the format given" Watch "Checking whether the date entered within textfield does comply with the format given" New topic
Author

Checking whether the date entered within textfield does comply with the format given

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
have a text field, named "datedtext", which accepts date from user.

The property associated with date is of Date datatype in my entity class. What i want is that when the user enters the date and press enter, it should check whether it complies to format given.

Here is what i tried



How can i check whether it is in a given format? If it complies, parse() method will convert it into Date object.
All suggestions are welcomed.
Thanks


kunal
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
scroll down the topics on the first page for
'leave maskformatter null' (or similar)

you'll find an example there
 
jQuery in Action, 2nd edition
 
subject: Checking whether the date entered within textfield does comply with the format given