Here is an example I wrote of how to use it when listening out for what a user is typing in a TextField
public class MysteriousCaveDoor extends AnchorPane
{
@FXML
private TextField txtEnterSecretPhrase;
public MysteriousCaveDoor
{
txtTitle.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<extends String> observableValue, String s, String s2) {
//think of s2 as "newValue" in the Code.Makery Tutorial
if(s2.contains("open sesame"))
openTheCaveDoors(...);
}
});
}
}
No comments:
Post a Comment