If I understand your question correctly, you would do something like this in the initialize method of your "main" controller:
public class MainController {
@FXML
private GridPane gridpane ;
public void initialize() throws IOException {
int numCols = ... ;
int numRows = ... ;
for (int rowIndex = 0 ; rowIndex < numRows ; rowIndex++) {
for (int colIndex = 0 ; colIndex < numCols ; colIndex++) {
FXMLLoader loader = new FXMLLoader(getClass().getResource("path/to/addtional/fxml"));
gridpane.add(loader.load(), colIndex, rowIndex);
}
}
}
}
For "interacting" with the components loaded from the additional fxml file, it is really the responsibility of the controller for the additional fxml. You can get a reference to each of those controllers after you load the fxml file:
gridpane.add(loader.load(), colIndex, rowIndex);
AdditionalController controller = loader.getController();
and then you can call methods that you have defined in that controller class. You haven't really provided enough detail about what you might want to do here, but, e.g.:
public class AdditionalController {
@FXML
private CheckBox checkBox ;
public BooleanProperty selectedProperty() {
return checkBox.selectedProperty();
}
// etc...
}
and then something like
gridpane.add(loader.load(), colIndex, rowIndex);
AdditionalController controller = loader.getController();
String s = String.format("Item [%d, %d]", colIndex, rowIndex);
controller.selectedProperty().addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected) {
// process selection...
System.out.println(s + " is selected");
}
});