This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes accepting only numbers in a text field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "accepting only numbers in a text field" Watch "accepting only numbers in a text field" New topic
Author

accepting only numbers in a text field

vinod kumar
Greenhorn

Joined: Jan 24, 2005
Posts: 15
hai all
I want a text field(jformattedtextfield) which accepts only numbers.It should not even display the other characters.That is here i am not interested in focus listener.Is there any method by which on enter(key press) itself the validation can be done so that other nonintegers are not typed(not accepted by the text field).
Vijay Vaddem
Ranch Hand

Joined: Feb 13, 2004
Posts: 243
Check this....
vinod kumar
Greenhorn

Joined: Jan 24, 2005
Posts: 15
thank u
it is working now.....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: accepting only numbers in a text field