I want the value we write in the textfield to be alphabetical only. It should not accept numeric values.How can I do that ?
I tried this codes but it is not working.
@FXML
void keyEventTextFieldSend(KeyEvent keyEvent){
Pattern pattern = Pattern.compile("^\\p{Alpha}+$");
textField.textProperty().addListener((ov, oldValue, newValue) -> {
Matcher matcher = pattern.matcher(newValue);
if(matcher.matches())
textField.setText(newValue.toUpperCase());
});
}