Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is JFormattedTextField evil? [closed]

In this question Is there any way to accept only numeric values in a JTextField? one of the answers suggested that JFormattedTextField had issues.

I've not yet used it, but could somebody please expand (or disagree) on the issues with this class?

like image 807
kwutchak Avatar asked Aug 24 '09 01:08

kwutchak


1 Answers

JFormattedTextField is evil because of poor usability. For instance, if a text field should only be able to accept an integer value, JFormattedTextField will allow any old rubbish and then complain when focus is lost. To make matters worse, it has a range of configurable behaviours when focus is lost (a clear sign that none of them is the correct choice).

It also has "k3wl" formatter selection. It also seems to have poor interaction with the document (it tries to install a DocumentFilter, but that is not part of the Document interface).

like image 60
Tom Hawtin - tackline Avatar answered Oct 07 '22 18:10

Tom Hawtin - tackline