title: Efficiently tracking first and second click Java - 2d array gui
body: <p>I am searching for a more efficient way of tracking the first and second click. Developing a board game and the way I have things working now I dont feel I can add all of the requirements in</p>
  
  <p>Here is how I track clicks at the moment.</p>
  
  <pre><code>  public void actionPerformed(ActionEvent ae){
       for(int row = 0; row &lt; boardGame.length; row++){   
       for(int col = 0; col &lt; boardGame.length; col++){
          if(ae.getSource() == boardGame[row][col]){
             if(isFirstClick){                                   
                fromRow = boardGame[row][col].getRow();
                fromCol = boardGame[row][col].getCol();
                this.checkTurn();
                System.out.println(boardGame[row][col].getPlayer());
                isFirstClick = false;
                }// end if
             else {
                toRow = boardGame[row][col].getRow();
                toCol = boardGame[row][col].getCol();
                movePiece();
                isFirstClick = true;
                createBoard();
             }// end else
          }// end get source
      }//end col
    } //end row   
  }
  </code></pre>
  
  <p>So while this works for the functionality I have at the moment.. I cant seem to get it to work with move validation. Is there a better way to get the first and second click?</p>