title: How can I access a control that's in a grid pane?
body: <p>I have defined a grid pane in a java fxml file as follows:</p>
  
  <pre><code>&lt;GridPane fx:id="grid" gridLinesVisible="true" prefHeight="256" prefWidth="256"&gt;
  
    ...
  
    &lt;children&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.columnIndex="1" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.columnIndex="2" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.rowIndex="1" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.columnIndex="1" GridPane.rowIndex="1" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.columnIndex="2" GridPane.rowIndex="1" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.rowIndex="2" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.columnIndex="1" GridPane.rowIndex="2" /&gt;
      &lt;Label maxHeight="1.8" maxWidth="1.8" GridPane.columnIndex="2" GridPane.rowIndex="2" /&gt;
    &lt;/children&gt;
  
    ...
  
  &lt;/GridPane&gt;
  </code></pre>
  
  <p>The grid is 3 x 3 and has a label in each of its cells. Is it possible to loop through the grid and change the text for each label as shown in the pseudo code below:</p>
  
  <pre><code>for (cell : grid)
  {
    cell.label.setText("x");
  }
  </code></pre>