Logo Search packages:      
Sourcecode: libjgoodies-forms-java version File versions  Download package

void com::jgoodies::forms::layout::FormLayout::removeColumn ( int  columnIndex  )  [inline]

Removes the column with the given column index from the layout. Components will be rearranged and column groups will be readjusted. Therefore, the column must not contain components and must not be part of a column group.

The component shift works as follows: components that were located on the right hand side of the removed column are moved one column to the left; component column span is decreased by one if it intersects the removed column.

Column group indices that are greater than the column index will be decreased by one.

Note: If one of the constraints mentioned above is violated, this layout's state becomes illegal and it is unsafe to work with this layout. A typical layout implementation can ensure that these constraints are not violated. However, in some cases you may need to check these conditions before you invoke this method. The Forms extras contain source code for class FormLayoutUtils that provides the required test methods:
columnContainsComponents(Container, int) and
isGroupedColumn(FormLayout, int).

Parameters:
columnIndex index of the column to remove
Exceptions:
IndexOutOfBoundsException if the column index is out of range
IllegalStateException if the column contains components or if the column is already grouped
See also:
com.jgoodies.forms.extras.FormLayoutUtils::columnContainsComponent(Container, int)

com.jgoodies.forms.extras.FormLayoutUtils::isGroupedColumn(FormLayout, int)

Definition at line 451 of file FormLayout.java.

References adjustGroupIndices(), colGroupIndices, colSpecs, getColumnCount(), and shiftComponentsHorizontally().

                                              {
        if (columnIndex < 1 || columnIndex > getColumnCount()) {
            throw new IndexOutOfBoundsException(
                    "The column index " + columnIndex + 
                    " must be in the range [1, " + getColumnCount() + "].");
        }
        colSpecs.remove(columnIndex - 1);
        shiftComponentsHorizontally(columnIndex, true);
        adjustGroupIndices(colGroupIndices, columnIndex, true);
    }


Generated by  Doxygen 1.6.0   Back to index