• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to allow total "void" (empty) value in JFormattedField while disallowing wrong inputs?  RSS feed

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently, if I enter empty values, the field get reverted, so as wrong values.
Now I want empty values to be allowed, while disallowing wrong values.
How do I achieve it?
Thanks
Jack
 
K. Tsang
Bartender
Posts: 3632
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JFormattedTextField is a JTextField. You can practically do all kinds of "validation" on the fly on a text field by attaching a DocumentListener to it.

Or you can just use JTextField.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!