I have a TabPane in my project that contains 3 different tabs, I would like to know how to add an event when changing "tab" in JavaFX.
For example, by clicking the "address" tab, create an event for me to add functionality to this tab.
Personally, I did like this:
It worked:)!
@FXML private TabPane tabPane;
tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
System.out.println("Tab Selection changed");
labelFruto.setText(fruto.getFruto());
}
});