This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
wood burning stoves
 
subject: User Input into a Text Field