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

void com::jgoodies::forms::layout::FormLayout::setColumnGroups ( int  colGroupIndices[][]  )  [inline]

Sets the column groups, where each column in a group gets the same group wide width. Each group is described by an array of integers that are interpreted as column indices. The parameter is an array of such group descriptions.

Examples:

 // Group columns 1, 3 and 4. 
 setColumnGroups(new int[][]{ {1, 3, 4}});

 // Group columns 1, 3, 4, and group columns 7 and 9
 setColumnGroups(new int[][]{ {1, 3, 4}, {7, 9}});
 

Parameters:
colGroupIndices a two-dimensional array of column groups indices
Exceptions:
IndexOutOfBoundsException if an index is outside the grid
IllegalArgumentException if a column index is used twice

Definition at line 713 of file FormLayout.java.

References deepClone(), and getColumnCount().

Referenced by addGroupedColumn(), com::jgoodies::forms::tutorial::basics::BoundedSizesExample::buildEditorGeneralPanel(), com::jgoodies::forms::tutorial::basics::BoundedSizesExample::buildEditorTransportPanel(), com::jgoodies::forms::tutorial::QuickStartExample::buildPanel(), com::jgoodies::forms::tutorial::building::IndentColumnExample::buildPanel(), com::jgoodies::forms::tutorial::building::FormDebugExample::buildPanel(), com::jgoodies::forms::layout::FormLayoutGroupsTest::testDeepCopyColumnGroups(), com::jgoodies::forms::layout::FormLayoutGroupsTest::testRejectDuplicateColumnIndex(), and com::jgoodies::forms::layout::FormLayoutGroupsTest::testRejectInvalidColumnIndex().

                                                         {
        int maxColumn = getColumnCount();
        boolean[] usedIndices = new boolean[maxColumn + 1];
        for (int group = 0; group < colGroupIndices.length; group++) {
            for (int j = 0; j < colGroupIndices[group].length; j++) {
                int colIndex = colGroupIndices[group][j];
                if (colIndex < 1 || colIndex > maxColumn) {
                    throw new IndexOutOfBoundsException(
                        "Invalid column group index " + colIndex + 
                        " in group " + (group+1)); 
                }
                if (usedIndices[colIndex]) {
                    throw new IllegalArgumentException(
                        "Column index " + colIndex + " must not be used in multiple column groups.");
                }
                usedIndices[colIndex] = true;
            }
        }
        this.colGroupIndices = deepClone(colGroupIndices);
    }


Generated by  Doxygen 1.6.0   Back to index