I wish to know if there's a way to set a minimum value and a maximum value which should be both integers to my Jtextfield input
What I succceeded to do is restricting the values entered to numeric only which is this
private void tfBMKeyTyped(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
char vchar = evt.getKeyChar();
if(!(Character.isDigit(vchar))
|| (vchar == KeyEvent.VK_BACK_SPACE)
|| (vchar == KeyEvent.VK_DELETE)){
evt.consume();
}
}
I just want to know if I can apply a range of integers to be entered to this. For examples (integers >= 1 and Integers <= 20)