wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes User Input into a Text Field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "User Input into a Text Field" Watch "User Input into a Text Field" New topic
Author

User Input into a Text Field

Dave Donohoe
Ranch Hand

Joined: May 16, 2000
Posts: 73
How do I restrict Users to only enter digits into a Text Field ?
I want to check before the User clicks OK.........
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi Dave,
IMO u will have to use consume() method of the AWTEvent class to consume the events of any key pressed/released that u want. once consumed the keys will not be shown in the text field/area.
Regds.
Rahul
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: User Input into a Text Field