如何在JavaFX中将内容从一个选项卡复制到另一个选项卡? [英] How to copy content from one tab to another in JavaFX?

查看:152
本文介绍了如何在JavaFX中将内容从一个选项卡复制到另一个选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图允许用户在我的应用程序中创建一个新选项卡。

I am trying to allow the user to create a new tab in my application.

我尝试了 tab.setContent(tag.getContent) ()); 但是它将一个标签的内容移动到另一个标签,将第一个标签留空。

I tried the tab.setContent(tag.getContent()); but it moves the content of one tab to the other leaving the first one empty.

有没有办法制作标签内容的副本?

Is there a way to make a copy of the tab content ?

推荐答案

我为一个标签创建了一个单独的FXML文件,为FXMl文件创建了一个加载器,然后加载它以获取根。使用root来构建场景,最后将场景添加到TabPane!

I made a separate FXML file for a tab, created a loader for the FXMl file, then load it to get the root. Use the root to build a scene and finally add the scene to the TabPane!

这篇关于如何在JavaFX中将内容从一个选项卡复制到另一个选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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