Can someone please help me out... I've tried all kinds of things (including help on here) and this just doesn't work. I'm using JFormattedTextField with a MaskFormatter to restrict data entry to 4 (max) digits.
static JFormattedTextField textPayout;
MaskFormatter f;
try {
f = new MaskFormatter("####");
} catch (ParseException e) {
e.printStackTrace();
return; // actual code not written yet.
}
textPayout = new JFormattedTextField(f);
The problem is that it's not restricting characters nor length (also, the texts starts to overlap itself if a non-number is entered). And I've tried a wide variety of mask-like operations. Can somebody please tell me what I'm doing wrong?
Thanks