Add a listener in textProperty, when there is a change in text, verify if the same is valid, if invalid set empty in text.
see:
textProperty().addListener(new ChangeListener<String>() {
private boolean inProgress;
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (inProgress) {
return;
}
inProgress = true;
try {
thow new Exception(); //here logic code for validation
} catch (ParseException e) {
setText("");
}
inProgress = false;
}
});
In the case above the TextField should be always empty.
But it's not what happens. Always gets a letter.
see:
textProperty().addListener(new ChangeListener<String>() {
private boolean inProgress;
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (inProgress) {
return;
}
inProgress = true;
try {
thow new Exception(); //here logic code for validation
} catch (ParseException e) {
setText("");
}
inProgress = false;
}
});
In the case above the TextField should be always empty.
But it's not what happens. Always gets a letter.
- blocks
-
JDK-8089218 LightPlayground: StackOverflowError on editing text in a TextInputControl
- Open
There are no Sub-Tasks for this issue.