【发布时间】:2020-01-14 20:07:34
【问题描述】:
如何使用 FXML 更改生成的项目?
创建 JavaFX 工具栏时,会自动生成嵌套的 HBox(或 VBox)。比如我想把这个生成的HBox的间距设置为0。
<ToolBar fx:id="welcomeToolBar" prefHeight="50">
<items>
<Button fx:id="closeButton" prefHeight="50" prefWidth="100" onAction="#closeWindow" text="Close" />
<Button text="New Image" prefHeight="50" prefWidth="100" onAction="#newImage" styleClass="button-accent"/>
<Pane HBox.hgrow="ALWAYS"/>
<CheckBox text="Hide this window on application start"
fx:id="hideOnLoadCheckBox" onAction="#setVisibilityOnApplicationLoad"/>
</items>
</ToolBar>
【问题讨论】:
-
您可能需要实现自己的
ToolBar。