Reputation: 71
How to enable tab when default is disabled in fxml?
... some code ...
<TabPane fx:id="tabpan" prefHeight="256.0" prefWidth="497.0" tabClosingPolicy="UNAVAILABLE">
<Tab id="shoppingltab" disable="true" text="Lists">
...
in controller I did make
@FXML private TabPane tabpan;
but i've got no idea how to enable this tab...
thx for help in advance
Upvotes: 1
Views: 5101
Reputation: 19622
You can just use the setDisable method on any tab that is bind to the controller
Upvotes: 0
Reputation: 209225
Inject the tab into the controller (as you do with the tab pane):
<Tab fx:id = "shoppingltab" ... >
and in the controller
@FXML private Tab shoppingltab;
Then you can enable the tab in the controller with
shoppingltab.setDisable(false);
Upvotes: 5