Event > key > KeyPressed
Asagidaki kodu yazinca ancak number kabul edir.
String value = txtNeceye.getText();
int l = value.length();
System.out.println(evt.getKeyCode());
if ((evt.getKeyChar() >= '0' && evt.getKeyChar() <= '9') || evt.getKeyCode()==8 || evt.getKeyCode()==127|| evt.getKeyCode()==37|| evt.getKeyCode()==39) {
txtNeceye.setEditable(true);
//label.setText("");
} else {
txtNeceye.setEditable(false);
//.setText("* Enter only numeric digits(0-9)");
}
No comments:
Post a Comment