@Override public void actionPerformed(ActionEvent ae){
  for (int i=0; i < currSize * currSize; i++) {
    if (ae.getSource() == squareButtons[i]) {
      NQueensController contr=(NQueensController)getController();
      XYLocation loc=new XYLocation(i % currSize,i / currSize);
      contr.modifySquare(loc);
    }
  }
}

@ Override public void actionPerformed ( ActionEvent ae ) { for ( int i = 0 ; i < currSize * currSize ; i ++ ) { if ( ae . getSource ( ) == squareButtons [ i ] ) { NQueensController contr = ( NQueensController ) getController ( ) ; XYLocation loc = new XYLocation ( i % currSize , i / currSize ) ; contr . modifySquare ( loc ) ; } } }
when the user presses square buttons the board state is modified accordingly .
