Value Change Listener for JavaFX’s TextField

Add a listener to the TextField’s textProperty:

TextField textField = new TextField();
textField.textProperty().addListener((observable, oldValue, newValue) -> {
    System.out.println("textfield changed from " + oldValue + " to " + newValue);
});

Leave a Comment