Is there any way to accept only numeric values in a JTextField
? Is there any special method for this?
You would like to take a look at JFormattedTextField
Formatted text fields provide a way for developers to specify the valid set of characters that can be typed in a text field
This is a subclass of JTextField, so you can use it like this:
JTextField textField = new JFormattedTextField(NumberFormat.getInstance());