0
I created a Choicebox, where at each selected level, a method should be called; but the following happens, any selected item calls the method; how to make a condition, that is, depending on the selected item, calls a certain method. Follow a part of the code.
ChoiceBox cb = new ChoiceBox();
cb.setId("btn_transparent_cb");
cb.getItems().addAll("Nível 1", "Nível 2", "Nível 3", "Nível 4");
//cb.getSelectionModel().selectFirst();
cb.getSelectionModel().selectedIndexProperty()
.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue ov, Number value, Number new_value) {
exemploMetodo();
}
});