Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1139
  • Last Modified:

JTextField

Is there a type of Text Entry Field that only allows the user to enter numeric data, such as dates?
0
rich420
Asked:
rich420
  • 3
  • 2
  • 2
  • +1
1 Solution
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now