code: private void shiftComponentsVertically(int rowIndex, boolean remove) {
          final int offset = remove ? -1 : 1;
          for (Object element : constraintMap.entrySet()) {
              Map.Entry entry = (Map.Entry) element;
              CellConstraints constraints = (CellConstraints) entry.getValue();
              int y1 = constraints.gridY;
              int h = constraints.gridHeight;
              int y2 = y1 + h - 1;
              if (y1 == rowIndex && remove) {
                  throw new IllegalStateException(
                          "The removed row " + rowIndex
                          + " must not contain component origins.\n"
                          + "Illegal component=" + entry.getKey());
              } else if (y1 >= rowIndex) {
                  constraints.gridY += offset;
              } else if (y2 >= rowIndex) {
                  constraints.gridHeight += offset;
              }
          }
      }
docs: Shifts components vertically, either to the bottom if a row has been inserted or to the top
  if a row has been removed.
  
  @param rowIndex index of the row to remove
  @param remove true for remove, false for insert
  @throws IllegalStateException if a removed column contains components