我是 JavaFx 的新手,我在 FXMl 中创建了两个 gridPane,我想在 Javafx 中做同样的事情。
我想创建扩展 GridPane 的类,所以当我调用我的类时,我将得到与 fxml 中相同的结果 PS:如果您使用的是 sceneBuiler,请检查网格线可见,以便您可以看到所有 GridPane 谢谢
<GridPane layoutX="138.0" layoutY="72.0">
<children>
<Label text="01" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Label text="01" GridPane.columnIndex="2" GridPane.rowIndex="0" />
<Label text="01" GridPane.columnIndex="3" GridPane.rowIndex="0" />
<Label text="01" GridPane.columnIndex="4" GridPane.rowIndex="0" />
<Label text="01" GridPane.columnIndex="0" GridPane.rowIndex="0" />
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
<GridPane layoutX="38.0" layoutY="102.0">
<children>
<Label prefWidth="74.0" text="Label" GridPane.columnIndex="0" GridPane.rowIndex="0" />
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="25.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>