/** * Resizes the grid to the specified number of rows. * * @param rows the number of rows * @throws IndexOutOfBoundsException */ public void resizeRows(int rows) { if (numRows == rows) { return; } if (rows < 0) { throw new IndexOutOfBoundsException("Cannot set number of rows to " + rows); } if (numRows < rows) { addRows(getBodyElement(), rows - numRows, numColumns); numRows = rows; } else { while (numRows > rows) { // Fewer rows. Remove extraneous ones. removeRow(numRows - 1); } } }
/** * Resizes the grid to the specified number of rows. * * @param rows the number of rows * @throws IndexOutOfBoundsException */ public void resizeRows(int rows) { if (numRows == rows) { return; } if (rows < 0) { throw new IndexOutOfBoundsException("Cannot set number of rows to " + rows); } if (numRows < rows) { addRows(getBodyElement(), rows - numRows, numColumns); numRows = rows; } else { while (numRows > rows) { // Fewer rows. Remove extraneous ones. removeRow(numRows - 1); } } }
/** * Resizes the grid to the specified number of rows. * * @param rows the number of rows * @throws IndexOutOfBoundsException */ public void resizeRows(int rows) { if (numRows == rows) { return; } if (rows < 0) { throw new IndexOutOfBoundsException("Cannot set number of rows to " + rows); } if (numRows < rows) { addRows(getBodyElement(), rows - numRows, numColumns); numRows = rows; } else { while (numRows > rows) { // Fewer rows. Remove extraneous ones. removeRow(numRows - 1); } } }