我有一个Button我想放在我的 BorderPane 底部并将其居中。我想用FXML.
这是我的 BorderPane 的底部:
<bottom>
<Button>
<text>
Center this button
</text>
</Button>
</bottom>
Run Code Online (Sandbox Code Playgroud)
完整FXML(不含进口):
<BorderPane id="BorderPane" xmlns:fx="http://javafx.com/fxml/1">
<top>
<HBox>
<BorderPane.margin>
<Insets left="15" right="15" top="15"/>
</BorderPane.margin>
<spacing>
5
</spacing>
<Label>
<padding>
<Insets top="5" right="5"/>
</padding>
<text>
Y-Axis:
</text>
</Label>
<TextField>
<text>
10
</text>
</TextField>
<Label>
<padding>
<Insets top="5" left="15" right="5"/>
</padding>
<text>
X-Axis:
</text>
</Label>
<TextField>
<text>
10
</text>
</TextField>
</HBox>
</top>
<bottom>
<Button>
<text>
Center this button
</text>
</Button>
</bottom>
Run Code Online (Sandbox Code Playgroud)
结果:
是否有任何标签可以使用 FXML 实现此目的?或者我必须用JAVA来做这个吗?谢谢你。
使用BorderPane.alignment:
<bottom>
<Button BorderPane.alignment="CENTER">
<text>
Center this button
</text>
</Button>
</bottom>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1722 次 |
| 最近记录: |