title: Drawing 2D array onto a grid
body: <p>I am making a board game called "Go" based of the actual board game. Basically, there are 2 players (White and Black) and they take turns placing white and black stones on the intersections of the board game grid. </p>
  
  <p>So far I have been able to draw the stone, alternate between players and change the value in my 2D array, where 0 = open spot, 1 = white, and 2 = black.</p>
  
  <p>I want to draw the corresponding stone from the 2D array onto my board. I am able to draw the correct stone and make it follow my mouse but once I click on the location I want it to be placed at the location and stay there. </p>
  
  <p>This is what I use to make the stone follow my mouse</p>
  
  <pre><code>if (turn == 1) {
      g2d.drawImage(s.getBlackStone(),
                    s.getBlackX() - Frame.frameLocation.x - 15,
                    s.getBlackY() - Frame.frameLocation.y - 35, null);
  } else {
      g2d.drawImage(s.getWhiteStone(),
                    s.getWhiteX() - Frame.frameLocation.x - 15,
                    s.getWhiteY() - Frame.frameLocation.y - 35, null);
  }
  </code></pre>
  
  <p>What I was thinking is I have a method that is called every time I press my mouse button and the method will get the grid location where my mouse is clicked and whos turn it is and draw the image. What are your guys thoughts on this? </p>