gpt4 book ai didi

java - 如何在 JavaFX FXML 中公平分配 VBox 中的节点

转载 作者:行者123 更新时间:2023-11-30 02:53:23 25 4
gpt4 key购买 nike

如何在 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>

该产品此 View :

enter image description here

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

enter image description here

最佳答案

根据 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>

产生此 View :

enter image description here

关于java - 如何在 JavaFX FXML 中公平分配 VBox 中的节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37988959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com