my dog learned polymorphism
The moose likes Swing / AWT / SWT and the fly likes DateValidation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "DateValidation" Watch "DateValidation" New topic


Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi friends,
I'm in a situation where i used as JTextField as a CellEditor for a JTable column.Column header is date.
How do i check the date is entered is a valid date.
One validation being:31-2-2004,moment the month is typed should restict as feb cant have 31 days.
Please give me some tip on this.How i can achive this
Thanks in adavnce
Serghei Jelauc
Ranch Hand

Joined: Jul 24, 2002
Posts: 128
Try to use JFormattedTextField as cell editor and SimpleDateFormat class.

SCJP 1.4 <br />SCBCD 1.3<br />SCWCD 1.4
Pritam Barhate

Joined: Nov 25, 2004
Posts: 15
Yes, using JFormattedTextField will solve the problem. If you want help on using JFormattedTextField then check out this quick tutorial at IBM developerWorks.

Pritam Barhate<br />A magic combination of <b>Code</b> & <b>Fire</b> : <a href="" target="_blank" rel="nofollow">codefire</a><br />----------------------------------- <br />My Open Source Projects:<br /><a href="" target="_blank" rel="nofollow">AceMDI</a>: A easy, yet powerful MDI framework that manages windows as Tabs.
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Thanks alot and also for the link u've given
I agree. Here's the link:
subject: DateValidation
It's not a secret anymore!