Implement textField focus-out event in JavaFX

Thing you want to do

--I want to implement an event when I focus out from the TextField component. --I want to replace characters automatically when focusing out.

What i did

By adding an event with ʻaddListener ()tofocusedProperty () in ʻinintialize (), we were able to add an event at focus out.

textField1.focusedProperty().addListener(new ChangeListener<Boolean>() {
    @Override 
    public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue,
        Boolean newPropertyValue) {
            if (!newPropertyValue) {
                textField1.setText(textField1.getText().replaceAll("Taka", "High"));
            }
        }
    }
);

version information

jdk 1.8.0_144

reference

Recommended Posts

Implement textField focus-out event in JavaFX
JavaFX8 file writing (TextField)
Implement CustomView in code
Implement markdown in Rails
Implement application function in Rails
[Beginner] Implement NavigationBar in code
Implement follow function in Rails
Implement two-step verification in Java
Implement LTI authentication in Rails
Implement Basic authentication in Java
Implement math combinations in Java
JavaFX environment construction in Java 13
2 Implement simple parsing in Java
[Android] Implement Adblock in WebView
Implement Email Sending in Java
Implement Swift UITextField in code
Implement import process in Rails
Implement functional quicksort in Java
Implement rm -rf in Java.
Implement XML signature in Java