--I want to implement an event when I focus out from the TextField component. --I want to replace characters automatically when focusing out.
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"));
}
}
}
);
jdk 1.8.0_144
Recommended Posts