File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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: 19693
    
  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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Validate textbox to accept only numeric values.