简体   繁体   English

在 TabPane JavaFX 上添加布局

[英]Add Layouts on TabPane JavaFX

i have a quick question.我有一个快速的问题。 I want to build an UI with JavaFX.我想用 JavaFX 构建一个 UI。 It should have tabs, each with some content.它应该有标签,每个标签都有一些内容。 The problem that I have is, I dont know how to arrange the content in the tabs properly.我遇到的问题是,我不知道如何正确安排选项卡中的内容。 Is there a possibility to add a Layout to the tabs?是否可以向选项卡添加布局? Like a Grid oder a Border Pane?像网格或边框窗格一样? And is it possible to have a different layout for each tab?是否可以为每个选项卡设置不同的布局?

Thanks for the help!谢谢您的帮助!

Not sure if Tab allows that as while setting component we only have setContent(Node) mehtod but Tab is like a container (Control)you can add a container (any children of Node object) like Border Pane ,Flow Pane which support Laying out their children.不确定 Tab 是否允许,因为在设置组件时我们只有 setContent(Node) 方法,但 Tab 就像一个容器(控制),你可以添加一个容器(节点对象的任何子项),比如 Border Pane ,Flow Pane 支持布局他们的孩子们。

 Tab tab = new Tab();

BorderPane borderPane = new BorderPane();
//Add some in borderPane
tab.setContent(borderPane);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM