void ensureValidGridBounds ( int colCount , int rowCount ) { if ( gridX <= 0 ) { throw new IndexOutOfBoundsException ( "The column index " + gridX + " must be positive." ) ; } if ( gridX > colCount ) { throw new IndexOutOfBoundsException ( "The column index " + gridX + " must be less than or equal to " + colCount + "." ) ; } if ( gridX + gridWidth - 1 > colCount ) { throw new IndexOutOfBoundsException ( "The grid width " + gridWidth + " must be less than or equal to " + ( colCount - gridX + 1 ) + "." ) ; } if ( gridY <= 0 ) { throw new IndexOutOfBoundsException ( "The row index " + gridY + " must be positive." ) ; } if ( gridY > rowCount ) { throw new IndexOutOfBoundsException ( "The row index " + gridY + " must be less than or equal to " + rowCount + "." ) ; } if ( gridY + gridHeight - 1 > rowCount ) { throw new IndexOutOfBoundsException ( "The grid height " + gridHeight + " must be less than or equal to " + ( rowCount - gridY + 1 ) + "." ) ; } }
Checks and verifies that this constraints object has valid grid index values i . e . the display area cells are inside the form s grid .