Is it possible for a MaskFormatter to create a pattern that accepts one or
many digits? I know JFormattedTextField is not for matching with RegExp-like
patterns. I just want to type any numer of digits and not receive getValue()
== null if the number of digits in "###" is smaller than 3 :/.
I'm thinking of something like this, where '|' stands for "or" in this
pattern
numer = new JFormattedTextField(new MaskFormatter("#|##|###"));
Thank you for any help
Rafal Bielec - 24 Dec 2003 17:57 GMT
In case somebody had the same problem this is what i've come up so far:
DecimalFormat df = new DecimalFormat("#####");
df.setMinimumIntegerDigits(0);
df.setMaximumIntegerDigits(5);
JFormattedTextField numer = new JFormattedTextField(df);
((NumberFormatter) numer.getFormatter()).setAllowsInvalid(false);