答案 0 :(得分:3)
在查看" Add Buttons to Tabs and Tab area JavaFX"的问题和答案之后,对它进行调整并不困难,因为它适用于FXML文件。
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mypackage.Controller">
<children>
<TabPane tabClosingPolicy="UNAVAILABLE" AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.bottomAnchor="0.0">
<tabs>
/* the code for the tabs goes here */
</tabs>
</TabPane>
<HBox AnchorPane.topAnchor="1.0" AnchorPane.rightAnchor="5.0">
<children>
<Button text="Export..." />
<Button text="Generate" />
</children>
</HBox>
</children>
</AnchorPane>
结果如下图所示。
答案 1 :(得分:2)
几个月前,只有几个星期的场景构建工作和FXML文件的应用程序,我尝试做类似的事情,但我没有成功尝试这样做,因为我认为如果你想添加一些标签,顶部的空间是保留的,我解决了我在插入所需标签的问题我会在那里的按钮,这里是我做的一个例子: enter image description here
我希望它对你也有用