I placed ChoiceBox inside fxml using Java Scene Builder.
FXML has a controller assigned to it.
My question is: what event do I need to register if I want to know about the changed values?
onInputMethodTextChanged="#languageSelectionModified"
this does not work with the following code
public void languageSelectionModified(Event event) {
ChoiceBox<String> box = (ChoiceBox<String>) event.getSource();
System.out.println(box.getValue());
}
and this only works for the initial click (i.e. opening a list, not when selecting an item):
onMouseClicked="#languageSelectionModified"
Although Mouse-Events will never be a good choice due to situations where a sensor or keyboard is an input method, it still proves that System.out can be achieved.
I absolutely do not know where these things are documented (in the Java API, this is not the case by default)
source
share