code: private void shiftComponentsHorizontally(int columnIndex, 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 x1 = constraints.gridX;
              int w = constraints.gridWidth;
              int x2 = x1 + w - 1;
              if (x1 == columnIndex && remove) {
                  throw new IllegalStateException(
                          "The removed column " + columnIndex
                          + " must not contain component origins.\n"
                          + "Illegal component=" + entry.getKey());
              } else if (x1 >= columnIndex) {
                  constraints.gridX += offset;
              } else if (x2 >= columnIndex) {
                  constraints.gridWidth += offset;
              }
          }
      }
docs: Shifts components horizontally, either to the right if a column has been inserted or to the
  left if a column has been removed.
  
  @param columnIndex index of the column to remove
  @param remove true for remove, false for insert
  @throws IllegalStateException if a removed column contains components