简体   繁体   中英

how to enable/disable tab in Javafx?

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

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);

您可以在绑定到控制器的任何选项卡上使用setDisable方法

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM