问题
I have a JavaFX TabPane in which I add new tabs dynamically when I click on a tree node.
tabPane.getTabs().add(tab);
tabPane.getSelectionModel().select(tab);
Can you tell me how I can open a new tab and place it always first before the other tabs.
回答1:
Try:
tabPane.getTabs().add(0, tab);
http://docs.oracle.com/javase/7/docs/api/java/util/List.html#add%28int,%20E%29
来源:https://stackoverflow.com/questions/17360079/how-to-open-a-new-tab-first-when-open-new-tab