question: final int eventToSquare ( MouseEvent evt ) { int xCrd = evt . getX ( ) ; int yCrd = evt . getY ( ) ; int sq = - 1 ; if ( ( xCrd >= x0 ) && ( yCrd >= y0 ) && ( sqSize > 0 ) ) { int x = ( xCrd - x0 ) / sqSize ; int y = 7 - ( yCrd - y0 ) / sqSize ; if ( ( x >= 0 ) && ( x < 8 ) && ( y >= 0 ) && ( y < 8 ) ) { if ( flipped ) { x = 7 - x ; y = 7 - y ; } sq = Position . getSquare ( x , y ) ; } } return sq ; }
target:  Compute the square corresponding to the coordinates of a mouse event.