How to open a new tab first when open new tab

 ̄綄美尐妖づ 提交于 2020-02-08 06:54:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!