title: JavaFX - Array of Controls
body: <p>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.</p>
  
  <p>But despite of the compiler/IDE not displaying any error this code below doesn't work:</p>
  
  <pre><code>public GridPane drawPane(){
      GridPane grid = new GridPane();
      Button[] btn = new Button[10];
      grid.add(btn[0], 0,0);
      return grid;
  }
  </code></pre>
  
  <p>however this one <strong>does work</strong>:</p>
  
  <pre><code>public GridPane drawPane(){
      GridPane grid = new GridPane();
      Button btn = new Button();
      grid.add(btn, 0,0);
      return grid;
  }
  </code></pre>
  
  <p>Am I instancing the controllers wrong? Why this code doesn't work with arrays ?</p>