首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JavaFX BorderPane中心底部

JavaFX BorderPane中心底部
EN

Stack Overflow用户
提问于 2018-04-25 16:46:51
回答 1查看 3.1K关注 0票数 2

我有一个Button,我想把它放在BorderPane的底部,并把它放在中间。我想通过FXML来实现这一点。

这是我的BorderPane的底部:

代码语言:javascript
复制
        <bottom>
            <Button>
                <text>
                    Center this button
                </text>
            </Button>
        </bottom>

完整的FXML (没有导入):

代码语言:javascript
复制
<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>

结果:

是否有任何标记可以用FXML实现这一目标?还是我必须用JAVA来完成这个任务?谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-25 17:10:16

使用BorderPane.alignment

代码语言:javascript
复制
<bottom>
    <Button BorderPane.alignment="CENTER">
        <text>
            Center this button
        </text>
    </Button>
</bottom>
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50027440

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档