I am looking for an alternative of Swing InputVerifier to JavaFX TextField.
The Swing InputVerifier will prevent input that does verify.
Consider the following S
As first suggested by James_D a TextFormatter with filter was the solution.
TextField instance = new TextField();
UnaryOperator textFilter = change -> {
String input = change.getText();
if (!change.isContentChange()) {
return change;
}
if (!myRegExTool.matches(input)) {
return null;
}
return change;
};
instance.setTextFormatter(new TextFormatter(textFilter));