I have a Java Desktop Application with JavaFX 2 in it and in my FX I\'ve got a TabPane. I want to set the default tab. In other words I want to set a tab as selected. I found th
If you work with statique tabs ,i mean your TabPane has statique number of tabs ,you can select your tab by this way :
SingleSelectionModel selectionModel = TabPane.getSelectionModel();
selectionModel.select(tabName);
If you work with dynamique tabs ,i mean your TabPane has dynamique number of tabs (add and remove tabs) ,you can select your tab by this way :
if (!TabPane.getTabs().contains(tabName)) {
TabPane.getTabs().add(tabName);
}
SingleSelectionModel selectionModel = TabPane.getSelectionModel();
selectionModel.select(tabPane);