wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes enter only numeric Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "enter only numeric" Watch "enter only numeric" New topic
Author

enter only numeric

Candy Bortniker
Ranch Hand

Joined: Mar 17, 2003
Posts: 123
Is there a way to add code that will only allow numbers to be entered in a field?
Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 210

Can you give more detail on exactly what you need? when you said field,
did you meant TextField in a GUI(Swing/AWT/whatever)? or it also can be
a TextArea? or taking input from the Console?
Candy Bortniker
Ranch Hand

Joined: Mar 17, 2003
Posts: 123
It would be a TextField in a GUI that I only want to allow numbers to be entered. Basically it would be for entering a social security number.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The Java Developer's Almanac online is a good source of examples; this one is very closely related to what you want to do.


[Jess in Action][AskingGoodQuestions]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I use this, your welcome to use it also.


Jamie
 
 
subject: enter only numeric
 
Similar Threads
What exactly is a data-tier
EL vs. JSP implicit objects
BBC to show World Cup LIVE online
88% on Part II/III (SCEA Beta)
retakes part 1,2,3