File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "User Input into a Text Field" Watch "User Input into a Text Field" New topic

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.........
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.
I agree. Here's the link:
subject: User Input into a Text Field
It's not a secret anymore!