This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JFormattedTextField validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFormattedTextField validation" Watch "JFormattedTextField validation" New topic

JFormattedTextField validation

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37953
Don't know. I presume you have looked for tutorials like this one?

I think this thread would sit better on our GUIs forum, so I shall move it.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
a JTextField with DocumentFilter set might suit you better
pete stein

Joined: Feb 23, 2007
Posts: 1561
Or perhaps all you need to do is use a standard JTextField and simply parse the textfield's text within a try/catch block, catching for NumberFormatException.
Nicol Green
Ranch Hand

Joined: Jan 30, 2010
Posts: 66
Yes definitely, JFormattedTextField was not the best option in my case. I will try what you proposed, and than tell you what was the best solution.

I agree. Here's the link:
subject: JFormattedTextField validation
Similar Threads
Reset of JTextField data
Which Swing component to use ?
Strange behavior of the JFormattedTextField
Use mask formatter in conjunction with a DateFormatter in Swing