[英]JavaFX FXML Center BorderPane bottom
I have a Button
which I would like to put to the bottom of my BorderPane and center it. 我有一个
Button
,我想将其放在BorderPane的底部并将其居中。 I want to achieve this with FXML
. 我想用
FXML
实现。
This is the bottom of my BorderPane: 这是我的BorderPane的底部:
<bottom>
<Button>
<text>
Center this button
</text>
</Button>
</bottom>
The full FXML
(without imports): 完整的
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>
The result: 结果:
Is there any Tag to achieve this with FXML? 是否有标签可以用FXML实现? Or do I have to do this with JAVA?
还是我必须使用JAVA做到这一点? Thank you.
谢谢。
Use BorderPane.alignment
: 使用
BorderPane.alignment
:
<bottom>
<Button BorderPane.alignment="CENTER">
<text>
Center this button
</text>
</Button>
</bottom>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.