This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 19656
    
  18

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Validate textbox to accept only numeric values.
 
Similar Threads
Regex question
Validating alpha and numeric chars in a form
Read everything as a String?
help
JTextField