当前位置: 首页 > 知识库问答 >
问题:

JavaFX FXML Center BorderPane底部

公瑞
2023-03-14

我有一个按钮,我想把它放在BorderPane的底部并居中。我想用fxml实现这一点。

这是我的边界窗格的底部:

        <bottom>
            <Button>
                <text>
                    Center this button
                </text>
            </Button>
        </bottom>

完整的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>

共有1个答案

支铭晨
2023-03-14

使用BorderPane.Aligny:

<bottom>
    <Button BorderPane.alignment="CENTER">
        <text>
            Center this button
        </text>
    </Button>
</bottom>
 类似资料:
  • 问题内容: 我通过包装面临的一个问题用。当尝试搜索其内容时,显示出底部溢出。下面是我的代码: 问题答案: 有 两个 解决方案。 添加到您的 将您的内容放入(如或)

  • import { Tabbar,TabbarItem } from 'feui'; components: { [Tabbar.name]: Tabbar [TabbarItem.name]: TabbarItem } 代码演示 <fe-tabbar> <tabbar-item> <img slot="icon" src="../assets/images/lo

  • 使用指南 组件介绍 ActionSheet 底部面板,从底部向上拉起操作菜单列表。 引入方式 import { Actionsheet } from 'feart'; components:{ 'fe-actionsheet':Actionsheet, } data() { return { show1: false, show2: false

  • 定义 底部弹层组件。 图片展示 代码演示 import FadeInUp from 'pile/dist/components/fadeinup' <FadeInUp show={true} changeFun={function(){console.log(123)}} contentPadding={true} closeShow={true} > <div clas

  • 定义 弹层按钮提示二次确认操作。 图片展示 代码演示 import Dialog from 'pile/dist/components/dialog' const {NConfirm } = Dialog <NConfirm show={true} title="同时会将我从对方列表列删除" hide={...fun} buttons=[ { label: '分享',

  • 实现tabbar建议采用小程序原生的tabbar,通过设置page/main.js(即对应小程序中app.json)来实现,详情请看小程序文档。示例如下,仅作参考: tabBar: { color: '#999999', selectedColor: '#1AAD16', backgroundColor: '#ffffff', borderStyle: 'white', /*

  • 底图       点击“底图”按钮,打开选择底图设置面板,选择需要的影像地图。