【问题标题】:How equitably distribute node in VBox in JavaFX FXMLJavaFX FXML中如何在VBox中公平分配节点
【发布时间】:2016-10-25 15:08:19
【问题描述】:

如何在一个 VBox 中平均分配几个部分? 换句话说,我有这个 FXML 代码:

<Tab text="SOO properties">
    <content>
        <VBox>
            <HBox>
                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Name" />
                <TextField />
            </HBox>
            <HBox>
                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Number of MobileEntity slots" />
                <TextField />
            </HBox>
            <HBox>
                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="MobileEntity buffer size" />
                <TextField />
            </HBox>
            <HBox>
                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Connections number" />
                <TextField />
            </HBox>
            <HBox>
                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Peripherals number" />
                <TextField />
            </HBox>
        </VBox>
    </content>
</Tab>

那个产品这个视图:

我怎样才能获得这样的东西?

【问题讨论】:

标签: java javafx fxml distribution vbox


【解决方案1】:

根据 GoXr3Plus,GridPane 非常适合这种情况:

<Tab text="SOO properties">
    <GridPane prefHeight="230.0" prefWidth="358.0">
        <columnConstraints>
            <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
            <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
        </columnConstraints>
        <rowConstraints>
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
        </rowConstraints>
        <children>
            <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Name" />
            <TextField GridPane.columnIndex="1" />
            <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Number of MobileEntity slots" GridPane.rowIndex="1" />
            <TextField GridPane.columnIndex="1" GridPane.rowIndex="1" />
            <Text strokeType="OUTSIDE" strokeWidth="0.0" text="MobileEntity buffer size" GridPane.rowIndex="2" />
            <TextField GridPane.columnIndex="1" GridPane.rowIndex="2" />
            <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Connections number" GridPane.rowIndex="3" />
            <TextField GridPane.columnIndex="1" GridPane.rowIndex="3" />
            <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Peripherals number" GridPane.rowIndex="4" />
            <TextField GridPane.columnIndex="1" GridPane.rowIndex="4" />
        </children>
    </GridPane>
</Tab>

产生这个视图:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-29
    • 2016-11-18
    • 2016-08-25
    • 1970-01-01
    • 2018-10-12
    • 1970-01-01
    • 2017-12-11
    相关资源
    最近更新 更多