I want to create an Array of JavaFX controllers in order to be easier to work with them e.g. you could loop adding/setting elements in a GridPane.
But despite of the compiler/IDE not displaying any error this code below doesn't work:
public GridPane drawPane(){
GridPane grid = new GridPane();
Button[] btn = new Button[10];
grid.add(btn[0], 0,0);
return grid;
}
however this one does work:
public GridPane drawPane(){
GridPane grid = new GridPane();
Button btn = new Button();
grid.add(btn, 0,0);
return grid;
}
Am I instancing the controllers wrong? Why this code doesn't work with arrays ?