javafx:当用户打开新文件时动态添加选项卡 [英] javafx: adding tabs dynamically when user opens a new file

查看:2406
本文介绍了javafx:当用户打开新文件时动态添加选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我编辑过的问题..我想要一个新的标签显示在同一个窗口中。在主窗口中,我有一个菜单栏。假设用户点击打开,则必须在菜单栏下方的同一个窗口中创建一个新的标签,等等。

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..

请注意,因为我是初学者在javafx中。我很感激你的时间和精力。

Kindly give me some pointers since I am a beginner in javafx. I appreciate your time and effort.

推荐答案

使用tabpane并以编程方式添加选项卡

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

这篇关于javafx:当用户打开新文件时动态添加选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆