GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Validate textbox to accept only numeric values. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Validate textbox to accept only numeric values." Watch "Validate textbox to accept only numeric values." New topic
Author

Validate textbox to accept only numeric values.

Poornima Rao
Greenhorn

Joined: Mar 08, 2011
Posts: 1
I'm new to java and would like to know how to validate a text field to accept only numeric values.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Please SearchFirst. This question has come up quite a few times already.

Easiest way: use a JSpinner. The user can type in it, but also use the up-down buttons.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: Validate textbox to accept only numeric values.