Reputation: 159
In html we have:
<input type="number">
It does not allow the alphabets to be inserted in the field.
Is there any way to do the same with JTextField in Java.
Upvotes: 0
Views: 352
Reputation: 1789
You can use JFormattedTextField to achieve this.
JTextField text = new JFormattedTextField(NumberFormat.getIntegerInstance());
Upvotes: 2