在JavaFX 8中,有没有一种方法可以将按钮放入TabPane中,如下面的样机所示?如果可能,我只想使用FXML文件。

发布于 2016-08-30 17:11:23
在看了"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>结果如下图所示。

发布于 2016-08-29 20:58:34
几个月前,我使用场景构建器和一个应用程序的FXML文件工作了几周后,我尝试做了类似的事情,但没有成功,因为我认为顶部的空间是保留的如果你想添加一些标签,我解决了我的问题,在所需的标签中插入了我想要的按钮,下面是我所做的一个例子:enter image description here
我希望它对你也有用。
https://stackoverflow.com/questions/39205244
复制相似问题