Comment puis-je générer un nouvel événement à gérer chaque fois que le texte de TextField est modifié?
ma solution:
....
String temp;
....
//previously in some method when starting to take initial value of the textfield and save it in a temporal
temp=id_textfield.getText();
....
//when losing focus we check if the new value is different
id_textfield.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
//focus in
if (newValue) {
temp = id_textfield.getText();
}
//focus out
if (oldValue) {
if (!(temp.equals(id_textfield.getText()))) {
System.out.println("New String")
}
}
}
});