I would like to run a function when a Tab is clicked. I tried to do this in my fxml but I think Tabs do not have an onAction property to call.
<Tab fx:id="Tab1" text="Tab1" onAction="#loadTab1">
</Tab>
So I get this error when I run the application:
Caused by: java.lang.UnsupportedOperationException: Cannot determine type for property.
One simple solution to register the tab selection is this:
Tab1.setOnSelectionChanged(e -> {
System.out.println(Tab1.isSelected() ? "Tab1 is selected" : "Tab1 is not selected" );
});