title: JavaFX - How do I know where a button in a GridPane exists?
body: <p>I have a fxml file which has GridPane and I wanna locate buttons in each square of the GridPane. Then I wanna show an image on a button which is just clicked. However, when a button is clicked and a method in controller is called, there seems to be no information about the location of the clicked button. Without this, I can't know what square to show an image. How can I solve this problem?</p>
  
  <p>I'm using JavaFX ScneBuilder2.0.
  I've already tried to make a lot of methods the number of which corresponds with the number of square in GridPane. Obviously it resulted in producing too long source file and I gave up to do that.</p>
  
  <p>Here is part of controller class.</p>
  
  <pre class="lang-java prettyprint-override"><code>//GomokuController.java
  package client;
  
  import javafx.fxml.FXML;
  import javafx.scene.control.Button;
  import javafx.scene.layout.GridPane;
  
  public class GomokuController implements Initializable{
      @FXML private GridPane gomokuBoard;
      @FXML private Button[][] put_stone_button = new Button[15][15];
  
      @FXML public void put_stone(){
        //called by pushing a button in the GridPane
        //I wanna know in which square the pushed button locates.
      }
  }
  </code></pre>