JavaFX TextArea onChange event
Using Lambda expressions
textArea.textProperty().addListener((obs,old,niu)->{
// TODO here
});
As with all of JavaFX, just add a listener to the TextArea textProperty()
.
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
textArea.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(final ObservableValue<? extends String> observable, final String oldValue, final String newValue) {
// this will run whenever text is changed
}
});