Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 REST with Spring (video course) this week in the Spring 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: 45335
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.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: JFormattedTextField validation
jQuery in Action, 3rd edition