user2044918
user2044918

Reputation:

Introducing just numbers form an interval in a TextField in Java

How can I add just numbers betwwen 0 and 255 in a FormattedTextField in Java?

I tried this way :

private JFormattedTextField text4;
//...
text4= new JFormattedTextField(paymentFormat);
    text4.getValue();
    text4.setColumns(3);
    try {
        MaskFormatter mask = new MaskFormatter("###");
        mask.install(text4);
    } catch (ParseException ex) {
       System.out.print("Valoarea nu e corecta");
    }

and it doesn`t work...

Upvotes: 0

Views: 249

Answers (1)

mKorbel
mKorbel

Reputation: 109813

there are two ways

Upvotes: 1

Related Questions