我有以下类和fxmls:
我想有2排2层的网格
我想将GAdata. fxml添加到GridPane中的每个单元格
如何将GAdata. fxml添加到每个单元格?(此外,每个单元格都有自己的控制器(GDdataController.java)?
所以你有主. fxml
文件,然后你可以使用
无论您想从其他. fxml
文件中添加数据的何处。例如:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.GridPane?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
prefHeight="400.0" prefWidth="600.0">
<GridPane fx:id="pane">
<fx:include source="Child.fxml" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
<fx:include source="Child.fxml" GridPane.columnIndex="1" GridPane.rowIndex="0"/>
<fx:include source="Child.fxml" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
<fx:include source="Child.fxml" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
</GridPane>
</AnchorPane>