问题
This is my edited question.. I want a new tab to be displayed in the same window. In the main window, i have a menu bar. Suppose the user clicks open, a new tab must be created in the same window below the menu bar and so on..
Kindly give me some pointers since I am a beginner in javafx. I appreciate your time and effort.
回答1:
use tabpane and add tabs to it programmatically
TabPane tabPane = new TabPane();
Tab mytab = new Tab("tab to be created programmatically");
mytab.setContent(put your data here);
tabPane.getTabs().add(mytab);
the tabpane should be in the window/node/scene that you are flirting with ...that's all
来源:https://stackoverflow.com/questions/26591505/javafx-adding-tabs-dynamically-when-user-opens-a-new-file