I have JFormattedTextField s in my form. I want to validate the length and characters that are being inserted in the field.
e.g FirstName must not allow a length more that 20 characters and should not allow any special and numeric characters being inserted. Space can be considered.
Please help me how can I achieve this goal.
I want to validate the length and characters that are being inserted in the field.
Use a MaskFormatter
with your JFormattedTextField
. With the MaskFormatter you can:
Read the API for more information and examples.