JTextField

Is there a type of Text Entry Field that only allows the user to enter numeric data, such as dates?
rich420Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

glottisCommented:
if u use jdk1.4 then there is JFormatTextField
else you can search for such components, or if u are a genius you can make one :P
0
rich420Author Commented:
thanks for that, but I couldn't find a JFormatTextField, or am I using the wrong version.

Did you mean JFormattedTextField? If so, How do I use JFormattedTextField to accept dates only?

Could I have a small example or explanation
0
umangjoshiCommented:
glottis is right.

for date u can use thre list box for dd, mm and yyyy and a script for validation
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

rich420Author Commented:
I am not allowed to have any validation scripts, because invalid characters should not even be allowed to be typed into the text field.
0
umangjoshiCommented:
u r right, but i haven't any more idea
0
glottisCommented:
JFormattedTextField ftf = new JFormattedTextField();
ftf.setValue(new Date()); // for dates

ftf.setValue(new Integer(1)); // for numbers

if u study the JFormattedTextField u can add poissibly any type of format
0
hamish5Commented:
JFormattedTextField field = new JFormattedTextField();
field.setValue(new Format(##-##-##));
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.