I want to do some actions when user goes from one tab to another, since i made my form design with Scene Builder I cannot use code mentioned here (He used TabPaneBuilder
class)
I guessed this code would work but it doesn't react to tab selection changes.
@FXML
protected TabPane chatTabs;
.
.
.
chatTabs.selectionModelProperty().addListener(
new ChangeListener<SingleSelectionModel<Tab>> {
@Override
public void changed(ObservableValue<? extends SingleSelectionModel<Tab>> ov, SingleSelectionModel<Tab> t, SingleSelectionModel<Tab> t1) {
System.err.println("changed");
}
}
}
);