Is there any way to accept only numeric values in a JTextField? Is there any special method for this?
JTextField
Try this out in the key pressed event for the related JTextField.
private void JTextField(java.awt.event.KeyEvent evt) { // TODO add your handling code here: char enter = evt.getKeyChar(); if(!(Character.isDigit(enter))){ evt.consume(); } }