Click to See Complete Forum and Search --> : Accepting Date in jTextField
periyasamy
September 24th, 2000, 12:59 PM
I want to accept only the Date in a suitable format in the jTextField. If the user enters anything else than Date, I should display a error message. I would really appreciate if anyone help me in giving me a suitable solution. Same thing even for number also.
cpraveenbabu
September 29th, 2000, 05:07 AM
Hi,
The most efficient way is having a drop down menu instead of JText field..U can hard code the numberdate,month name,year..
Thats efficient.
Otherwise answering for ur question...
Get the text entered from the text field by getText() and check whether it is an int..
Otherwise display an error message
Hope this helps
Regards
Praveen
When going gets tough,
Tough gets going.
unicman
October 1st, 2000, 03:05 PM
Well... I had developed a reusable component for this. Its name is JDateTextField. It is posted on this site under java swing section.
See if it suites your needs.
- UnicMan
http://members.tripod.com/unicman
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.