maskformatter java number and space

722 Views Asked by At

I used maskformatter for my jtextfield.

It works like a charm but the problem is that I cant delete the number in the jtextfield.

f = new MaskFormatter( "#" );
f.setValidCharacters("123456789");

How can I include the space character so that I can accept space and digits from 1-9?

1

There are 1 best solutions below

0
maxxy On
f = new MaskFormatter( "*" );
f.setValidCharacters("123456789 ");

accept all characters and include space..

This works for me