MaskedFormatter help

S

sasquatch

I am trying to use a MaskedFormatter in a JFormattedTextField to
disallow the user from entering anything but a number less than 4
digits long. To allow a 3 digit number, I can use "###" for the mask,
but how do I allow 3, 2 and 1 digit numbers? I.e. how do I make a mask
that allows *upto* 3 digits instead of exactly 3 digits?

Sasquatch
 
K

Knute Johnson

sasquatch said:
I am trying to use a MaskedFormatter in a JFormattedTextField to
disallow the user from entering anything but a number less than 4
digits long. To allow a 3 digit number, I can use "###" for the mask,
but how do I allow 3, 2 and 1 digit numbers? I.e. how do I make a mask
that allows *upto* 3 digits instead of exactly 3 digits?

Sasquatch

I don't think you can that way. Use an InputVerifier to limit a range
of numbers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top