Example usage for java.awt Container getComponent

List of usage examples for java.awt Container getComponent

Introduction

In this page you can find the example usage for java.awt Container getComponent.

Prototype

public Component getComponent(int n) 

Source Link

Document

Gets the nth component in this container.

Usage

From source file:VerticalFlowLayout.java

/**
 *  Description of the Method/*  w w  w. ja  va  2  s . co m*/
 *
 *@param  target  Description of Parameter
 */
public void layoutContainer(Container target) {
    synchronized (target.getTreeLock()) {
        Insets insets = target.getInsets();
        int maxheight = target.getHeight() - (insets.top + insets.bottom + _vgap * 2);
        int nmembers = target.getComponentCount();
        int y = 0;

        Dimension preferredSize = preferredLayoutSize(target);
        Dimension targetSize = target.getSize();

        switch (_valign) {
        case TOP:
            y = insets.top;
            break;
        case CENTER:
            y = (targetSize.height - preferredSize.height) / 2;
            break;
        case BOTTOM:
            y = targetSize.height - preferredSize.height - insets.bottom;
            break;
        }

        for (int i = 0; i < nmembers; i++) {
            Component m = target.getComponent(i);
            if (m.isVisible()) {
                Dimension d = m.getPreferredSize();
                m.setSize(d.width, d.height);

                if ((y + d.height) <= maxheight) {
                    if (y > 0) {
                        y += _vgap;
                    }

                    int x = 0;
                    switch (_halign) {
                    case LEFT:
                        x = insets.left;
                        break;
                    case CENTER:
                        x = (targetSize.width - d.width) / 2;
                        break;
                    case RIGHT:
                        x = targetSize.width - d.width - insets.right;
                        break;
                    }

                    m.setLocation(x, y);

                    y += d.getHeight();

                } else {
                    break;
                }
            }
        }
    }
}

From source file:Main.java

public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    int maxWidth = parent.getWidth() - (insets.left + insets.right);
    int maxHeight = parent.getHeight() - (insets.top + insets.bottom);
    int nComps = parent.getComponentCount();
    int previousWidth = 0, previousHeight = 0;
    int x = 0, y = insets.top;
    int rowh = 0, start = 0;
    int xFudge = 0, yFudge = 0;
    boolean oneColumn = false;

    // Go through the components' sizes, if neither
    // preferredLayoutSize nor minimumLayoutSize has
    // been called.
    if (sizeUnknown) {
        setSizes(parent);//from   www  .j  a  v a  2s .c o m
    }

    if (maxWidth <= minWidth) {
        oneColumn = true;
    }

    if (maxWidth != preferredWidth) {
        xFudge = (maxWidth - preferredWidth) / (nComps - 1);
    }

    if (maxHeight > preferredHeight) {
        yFudge = (maxHeight - preferredHeight) / (nComps - 1);
    }

    for (int i = 0; i < nComps; i++) {
        Component c = parent.getComponent(i);
        if (c.isVisible()) {
            Dimension d = c.getPreferredSize();

            // increase x and y, if appropriate
            if (i > 0) {
                if (!oneColumn) {
                    x += previousWidth / 2 + xFudge;
                }
                y += previousHeight + vgap + yFudge;
            }

            // If x is too large,
            if ((!oneColumn) && (x + d.width) > (parent.getWidth() - insets.right)) {
                // reduce x to a reasonable number.
                x = parent.getWidth() - insets.bottom - d.width;
            }

            // If y is too large,
            if ((y + d.height) > (parent.getHeight() - insets.bottom)) {
                // do nothing.
                // Another choice would be to do what we do to x.
            }

            // Set the component's size and position.
            c.setBounds(x, y, d.width, d.height);

            previousWidth = d.width;
            previousHeight = d.height;
        }
    }
}

From source file:GraphPaperLayout.java

/**
 * Lays out the container in the specified container.
 * /*  w  w  w. ja v  a  2 s.  com*/
 * @param parent
 *          the component which needs to be laid out
 */
public void layoutContainer(Container parent) {
    synchronized (parent.getTreeLock()) {
        Insets insets = parent.getInsets();
        int ncomponents = parent.getComponentCount();

        if (ncomponents == 0) {
            return;
        }

        // Total parent dimensions
        Dimension size = parent.getSize();
        int totalW = size.width - (insets.left + insets.right);
        int totalH = size.height - (insets.top + insets.bottom);

        // Cell dimensions, including padding
        int totalCellW = totalW / gridSize.width;
        int totalCellH = totalH / gridSize.height;

        // Cell dimensions, without padding
        int cellW = (totalW - ((gridSize.width + 1) * hgap)) / gridSize.width;
        int cellH = (totalH - ((gridSize.height + 1) * vgap)) / gridSize.height;

        for (int i = 0; i < ncomponents; i++) {
            Component c = parent.getComponent(i);
            Rectangle rect = compTable.get(c);
            if (rect != null) {
                int x = insets.left + (totalCellW * rect.x) + hgap;
                int y = insets.top + (totalCellH * rect.y) + vgap;
                int w = (cellW * rect.width) - hgap;
                int h = (cellH * rect.height) - vgap;
                c.setBounds(x, y, w, h);
            }
        }
    }
}

From source file:GraphPaperTest.java

/**
 * Lays out the container in the specified container.
 * /*w w  w . j  a  va  2 s .c o m*/
 * @param parent
 *            the component which needs to be laid out
 */
public void layoutContainer(Container parent) {
    synchronized (parent.getTreeLock()) {
        Insets insets = parent.getInsets();
        int ncomponents = parent.getComponentCount();

        if (ncomponents == 0) {
            return;
        }

        // Total parent dimensions
        Dimension size = parent.getSize();
        int totalW = size.width - (insets.left + insets.right);
        int totalH = size.height - (insets.top + insets.bottom);

        // Cell dimensions, including padding
        int totalCellW = totalW / gridSize.width;
        int totalCellH = totalH / gridSize.height;

        // Cell dimensions, without padding
        int cellW = (totalW - ((gridSize.width + 1) * hgap)) / gridSize.width;
        int cellH = (totalH - ((gridSize.height + 1) * vgap)) / gridSize.height;

        for (int i = 0; i < ncomponents; i++) {
            Component c = parent.getComponent(i);
            Rectangle rect = (Rectangle) compTable.get(c);
            if (rect != null) {
                int x = insets.left + (totalCellW * rect.x) + hgap;
                int y = insets.top + (totalCellH * rect.y) + vgap;
                int w = (cellW * rect.width) - hgap;
                int h = (cellH * rect.height) - vgap;
                c.setBounds(x, y, w, h);
            }
        }
    }
}

From source file:ca.canucksoftware.ipkpackager.IpkPackagerView.java

private void disableNewFolderButton(Container c) {
    int len = c.getComponentCount();
    for (int i = 0; i < len; i++) {
        Component comp = c.getComponent(i);
        if (comp instanceof JButton) {
            JButton b = (JButton) comp;
            Icon icon = b.getIcon();
            if (icon != null && (icon == UIManager.getIcon("FileChooser.newFolderIcon")
                    || icon == UIManager.getIcon("FileChooser.upFolderIcon")))
                b.setEnabled(false);//from   w  ww. ja  va2s.c  om
        } else if (comp instanceof Container) {
            disableNewFolderButton((Container) comp);
        }
    }
}

From source file:org.eclipse.jubula.rc.swing.components.AUTSwingHierarchy.java

/**
 * Returns all descendents of the given <code>component</code>
 * @param c a <code>component</code> value
 * @return a <code>collection</code> of the component's descendents or an
 * empty <code>collection</code> if nothing was found or <code>c</code> is null.
 *//*w  w  w .j a va  2 s . co m*/
private Collection getComponents(Component c) {
    if (c instanceof Container) {
        Container cont = (Container) c;
        List list = new ArrayList();
        list.addAll(Arrays.asList(cont.getComponents()));
        if (c instanceof JMenu) {
            list.add(((JMenu) c).getPopupMenu());
        } else if (c instanceof Window) {
            list.addAll(Arrays.asList(((Window) c).getOwnedWindows()));
        } else if (c instanceof JDesktopPane) {
            // add iconified frames, which are otherwise unreachable
            // for consistency, they are still considerered children of
            // the desktop pane.
            int count = cont.getComponentCount();
            for (int i = 0; i < count; i++) {
                Component child = cont.getComponent(i);
                if (child instanceof JInternalFrame.JDesktopIcon) {
                    JInternalFrame frame = ((JInternalFrame.JDesktopIcon) child).getInternalFrame();
                    if (frame != null) {
                        list.add(frame);
                    }
                }
            }
        }
        return list;
    }
    // an empty ArrayList
    return new ArrayList();
}

From source file:TableLayout.java

private void loadComponents(Container parent) {
    ncomponents = parent.getComponentCount();

    // If we haven't allocated the right sized array for each column yet, do so now.
    // Note that the number of columns is fixed, but the number of rows is not know
    // and could in the worst case be up the number of components. Unfortunately this
    // means we need to allocate quite big arrays, but the alternative would require
    // complex multiple passes as we try to work out the effect of row spanning.
    if (components[0] == null || components[0].length < ncomponents) {
        for (int i = 0; i < ncols; ++i)
            components[i] = new Component[ncomponents];
    }/*  w ww  .  j  a v a  2 s  . c  o m*/
    // Nullify the array
    for (int i = 0; i < ncols; ++i) {
        for (int j = 0; j < components[i].length; ++j)
            components[i][j] = null;
    }

    // fill the matrix with components, taking row/column spanning into account
    int row = 0, col = 0;
    for (int i = 0; i < ncomponents; ++i) {
        // get the next component and its options
        Component comp = parent.getComponent(i);
        TableOption option = (TableOption) options.get(comp);
        if (option == null)
            option = defaultOption;

        // handle options to force us to column 0 or to skip columns
        if (option.forceColumn >= 0) {
            if (col > option.forceColumn)
                ++row;
            col = option.forceColumn;
        }
        col += option.skipColumns;
        if (col >= ncols) {
            ++row;
            col = 0;
        }

        // skip over any cells that are already occupied
        while (components[col][row] != null) {
            ++col;
            if (col >= ncols) {
                ++row;
                col = 0;
            }
        }

        // if using colspan, will we fit on this row?
        if (col + option.colSpan > ncols) {
            ++row;
            col = 0;
        }

        // for now, fill all the cells that are occupied by this component
        for (int c = 0; c < option.colSpan; ++c)
            for (int r = 0; r < option.rowSpan; ++r)
                components[col + c][row + r] = comp;

        // advance to the next cell, ready for the next component
        col += option.colSpan;
        if (col >= ncols) {
            ++row;
            col = 0;
        }
    }

    // now we know how many rows there are
    if (col == 0)
        nrows = row;
    else
        nrows = row + 1;

    // now we've positioned our components we can thin out the cells so
    // we only remember the top left corner of each component
    for (row = 0; row < nrows; ++row) {
        for (col = 0; col < ncols; ++col) {
            Component comp = components[col][row];
            for (int r = row; r < nrows && components[col][r] == comp; ++r) {
                for (int c = col; c < ncols && components[c][r] == comp; ++c) {
                    if (r > row || c > col)
                        components[c][r] = null;
                }
            }
        }
    }
}

From source file:FormatLayout.java

/**
 * Returns the preferred size of the component using this layout manager.
 *
 * @param parent  the parent.//from ww  w  . ja v a2  s  . c om
 *
 * @return the preferred size of the component.
 */
public Dimension preferredLayoutSize(final Container parent) {

    Component c0, c1, c2, c3, c4, c5;

    synchronized (parent.getTreeLock()) {
        final Insets insets = parent.getInsets();
        int componentIndex = 0;
        final int rowCount = this.rowHeights.length;
        for (int i = 0; i < this.columnWidths.length; i++) {
            this.columnWidths[i] = 0;
        }
        this.columns1and2Width = 0;
        this.columns4and5Width = 0;
        this.columns1to4Width = 0;
        this.columns1to5Width = 0;
        this.columns0to5Width = 0;

        this.totalHeight = 0;
        for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
            final int format = this.rowFormats[rowIndex % this.rowFormats.length];
            switch (format) {
            case FormatLayout.C:
                c0 = parent.getComponent(componentIndex);
                updateC(rowIndex, c0.getPreferredSize());
                componentIndex = componentIndex + 1;
                break;
            case FormatLayout.LC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                updateLC(rowIndex, c0.getPreferredSize(), c1.getPreferredSize());
                componentIndex = componentIndex + 2;
                break;
            case FormatLayout.LCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                updateLCB(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize());
                componentIndex = componentIndex + 3;
                break;
            case FormatLayout.LCLC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                updateLCLC(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize());
                componentIndex = componentIndex + 4;
                break;
            case FormatLayout.LCBLC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                updateLCBLC(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize(), c4.getPreferredSize());
                componentIndex = componentIndex + 5;
                break;
            case FormatLayout.LCLCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                updateLCLCB(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize(), c4.getPreferredSize());
                componentIndex = componentIndex + 5;
                break;
            case FormatLayout.LCBLCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                c5 = parent.getComponent(componentIndex + 5);
                updateLCBLCB(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize(), c4.getPreferredSize(), c5.getPreferredSize());
                componentIndex = componentIndex + 6;
                break;
            }
        }
        complete();
        return new Dimension(this.totalWidth + insets.left + insets.right,
                this.totalHeight + (rowCount - 1) * this.rowGap + insets.top + insets.bottom);
    }
}

From source file:FormatLayout.java

/**
 * Returns the minimum size of the component using this layout manager.
 *
 * @param parent  the parent.//from  w  ww .  j  av  a  2 s  . c  o  m
 *
 * @return the minimum size of the component
 */
public Dimension minimumLayoutSize(final Container parent) {

    Component c0, c1, c2, c3, c4, c5;

    synchronized (parent.getTreeLock()) {
        final Insets insets = parent.getInsets();
        int componentIndex = 0;
        final int rowCount = this.rowHeights.length;
        for (int i = 0; i < this.columnWidths.length; i++) {
            this.columnWidths[i] = 0;
        }
        this.columns1and2Width = 0;
        this.columns4and5Width = 0;
        this.columns1to4Width = 0;
        this.columns1to5Width = 0;
        this.columns0to5Width = 0;
        final int totalHeight = 0;
        for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {

            final int format = this.rowFormats[rowIndex % this.rowFormats.length];

            switch (format) {
            case FormatLayout.C:
                c0 = parent.getComponent(componentIndex);
                this.columns0to5Width = Math.max(this.columns0to5Width, c0.getMinimumSize().width);
                componentIndex = componentIndex + 1;
                break;
            case FormatLayout.LC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                updateLC(rowIndex, c0.getMinimumSize(), c1.getMinimumSize());
                componentIndex = componentIndex + 2;
                break;
            case FormatLayout.LCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                updateLCB(rowIndex, c0.getMinimumSize(), c1.getMinimumSize(), c2.getMinimumSize());
                componentIndex = componentIndex + 3;
                break;
            case FormatLayout.LCLC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                updateLCLC(rowIndex, c0.getMinimumSize(), c1.getMinimumSize(), c2.getMinimumSize(),
                        c3.getMinimumSize());
                componentIndex = componentIndex + 3;
                break;
            case FormatLayout.LCBLC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                updateLCBLC(rowIndex, c0.getMinimumSize(), c1.getMinimumSize(), c2.getMinimumSize(),
                        c3.getMinimumSize(), c4.getMinimumSize());
                componentIndex = componentIndex + 4;
                break;
            case FormatLayout.LCLCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                updateLCLCB(rowIndex, c0.getMinimumSize(), c1.getMinimumSize(), c2.getMinimumSize(),
                        c3.getMinimumSize(), c4.getMinimumSize());
                componentIndex = componentIndex + 4;
                break;
            case FormatLayout.LCBLCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                c5 = parent.getComponent(componentIndex + 5);
                updateLCBLCB(rowIndex, c0.getMinimumSize(), c1.getMinimumSize(), c2.getMinimumSize(),
                        c3.getMinimumSize(), c4.getMinimumSize(), c5.getMinimumSize());
                componentIndex = componentIndex + 5;
                break;
            }
        }
        complete();
        return new Dimension(this.totalWidth + insets.left + insets.right,
                totalHeight + (rowCount - 1) * this.rowGap + insets.top + insets.bottom);
    }
}

From source file:FormatLayout.java

/**
 * Performs the layout of the container.
 *
 * @param parent  the parent.//from  w  w w. j a  va2s.c o m
 */
public void layoutContainer(final Container parent) {
    Component c0, c1, c2, c3, c4, c5;

    synchronized (parent.getTreeLock()) {
        final Insets insets = parent.getInsets();
        int componentIndex = 0;
        final int rowCount = this.rowHeights.length;
        for (int i = 0; i < this.columnWidths.length; i++) {
            this.columnWidths[i] = 0;
        }
        this.columns1and2Width = 0;
        this.columns4and5Width = 0;
        this.columns1to4Width = 0;
        this.columns1to5Width = 0;
        this.columns0to5Width = parent.getBounds().width - insets.left - insets.right;

        this.totalHeight = 0;
        for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
            final int format = this.rowFormats[rowIndex % this.rowFormats.length];
            switch (format) {
            case FormatLayout.C:
                c0 = parent.getComponent(componentIndex);
                updateC(rowIndex, c0.getPreferredSize());
                componentIndex = componentIndex + 1;
                break;
            case FormatLayout.LC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                updateLC(rowIndex, c0.getPreferredSize(), c1.getPreferredSize());
                componentIndex = componentIndex + 2;
                break;
            case FormatLayout.LCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                updateLCB(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize());
                componentIndex = componentIndex + 3;
                break;
            case FormatLayout.LCLC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                updateLCLC(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize());
                componentIndex = componentIndex + 4;
                break;
            case FormatLayout.LCBLC:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                updateLCBLC(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize(), c4.getPreferredSize());
                componentIndex = componentIndex + 5;
                break;
            case FormatLayout.LCLCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                updateLCLCB(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize(), c4.getPreferredSize());
                componentIndex = componentIndex + 5;
                break;
            case FormatLayout.LCBLCB:
                c0 = parent.getComponent(componentIndex);
                c1 = parent.getComponent(componentIndex + 1);
                c2 = parent.getComponent(componentIndex + 2);
                c3 = parent.getComponent(componentIndex + 3);
                c4 = parent.getComponent(componentIndex + 4);
                c5 = parent.getComponent(componentIndex + 5);
                updateLCBLCB(rowIndex, c0.getPreferredSize(), c1.getPreferredSize(), c2.getPreferredSize(),
                        c3.getPreferredSize(), c4.getPreferredSize(), c5.getPreferredSize());
                componentIndex = componentIndex + 6;
                break;
            }
        }
        complete();

        componentIndex = 0;
        int rowY = insets.top;
        final int[] rowX = new int[6];
        rowX[0] = insets.left;
        rowX[1] = rowX[0] + this.columnWidths[0] + this.columnGaps[0];
        rowX[2] = rowX[1] + this.columnWidths[1] + this.columnGaps[1];
        rowX[3] = rowX[2] + this.columnWidths[2] + this.columnGaps[2];
        rowX[4] = rowX[3] + this.columnWidths[3] + this.columnGaps[3];
        rowX[5] = rowX[4] + this.columnWidths[4] + this.columnGaps[4];
        final int w1to2 = this.columnWidths[1] + this.columnGaps[1] + this.columnWidths[2];
        final int w4to5 = this.columnWidths[4] + this.columnGaps[4] + this.columnWidths[5];
        final int w1to4 = w1to2 + this.columnGaps[2] + this.columnWidths[3] + this.columnGaps[3]
                + this.columnWidths[4];
        final int w1to5 = w1to4 + this.columnGaps[4] + this.columnWidths[5];
        final int w0to5 = w1to5 + this.columnWidths[0] + this.columnGaps[0];
        for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
            final int format = this.rowFormats[rowIndex % this.rowFormats.length];

            switch (format) {
            case FormatLayout.C:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY, w0to5, c0.getPreferredSize().height);
                componentIndex = componentIndex + 1;
                break;
            case FormatLayout.LC:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY + (this.rowHeights[rowIndex] - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height);
                c1 = parent.getComponent(componentIndex + 1);
                c1.setBounds(rowX[1], rowY + (this.rowHeights[rowIndex] - c1.getPreferredSize().height) / 2,
                        w1to5, c1.getPreferredSize().height);
                componentIndex = componentIndex + 2;
                break;
            case FormatLayout.LCB:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY + (this.rowHeights[rowIndex] - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height);
                c1 = parent.getComponent(componentIndex + 1);
                c1.setBounds(rowX[1], rowY + (this.rowHeights[rowIndex] - c1.getPreferredSize().height) / 2,
                        w1to4, c1.getPreferredSize().height);
                c2 = parent.getComponent(componentIndex + 2);
                c2.setBounds(rowX[5], rowY + (this.rowHeights[rowIndex] - c2.getPreferredSize().height) / 2,
                        this.columnWidths[5], c2.getPreferredSize().height);
                componentIndex = componentIndex + 3;
                break;
            case FormatLayout.LCLC:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY + (this.rowHeights[rowIndex] - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height);
                c1 = parent.getComponent(componentIndex + 1);
                c1.setBounds(rowX[1], rowY + (this.rowHeights[rowIndex] - c1.getPreferredSize().height) / 2,
                        w1to2, c1.getPreferredSize().height);
                c2 = parent.getComponent(componentIndex + 2);
                c2.setBounds(rowX[3], rowY + (this.rowHeights[rowIndex] - c2.getPreferredSize().height) / 2,
                        this.columnWidths[3], c2.getPreferredSize().height);
                c3 = parent.getComponent(componentIndex + 3);
                c3.setBounds(rowX[4], rowY + (this.rowHeights[rowIndex] - c3.getPreferredSize().height) / 2,
                        w4to5, c3.getPreferredSize().height);
                componentIndex = componentIndex + 4;
                break;
            case FormatLayout.LCBLC:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY + (this.rowHeights[rowIndex] - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height);
                c1 = parent.getComponent(componentIndex + 1);
                c1.setBounds(rowX[1], rowY + (this.rowHeights[rowIndex] - c1.getPreferredSize().height) / 2,
                        this.columnWidths[1], c1.getPreferredSize().height);
                c2 = parent.getComponent(componentIndex + 2);
                c2.setBounds(rowX[2], rowY + (this.rowHeights[rowIndex] - c2.getPreferredSize().height) / 2,
                        this.columnWidths[2], c2.getPreferredSize().height);
                c3 = parent.getComponent(componentIndex + 3);
                c3.setBounds(rowX[3], rowY + (this.rowHeights[rowIndex] - c3.getPreferredSize().height) / 2,
                        this.columnWidths[3], c3.getPreferredSize().height);
                c4 = parent.getComponent(componentIndex + 4);
                c4.setBounds(rowX[4], rowY + (this.rowHeights[rowIndex] - c4.getPreferredSize().height) / 2,
                        w4to5, c4.getPreferredSize().height);
                componentIndex = componentIndex + 5;
                break;
            case FormatLayout.LCLCB:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY + (this.rowHeights[rowIndex] - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height);
                c1 = parent.getComponent(componentIndex + 1);
                c1.setBounds(rowX[1], rowY + (this.rowHeights[rowIndex] - c1.getPreferredSize().height) / 2,
                        w1to2, c1.getPreferredSize().height);
                c2 = parent.getComponent(componentIndex + 2);
                c2.setBounds(rowX[3], rowY + (this.rowHeights[rowIndex] - c2.getPreferredSize().height) / 2,
                        this.columnWidths[3], c2.getPreferredSize().height);
                c3 = parent.getComponent(componentIndex + 3);
                c3.setBounds(rowX[4], rowY + (this.rowHeights[rowIndex] - c3.getPreferredSize().height) / 2,
                        this.columnWidths[4], c3.getPreferredSize().height);
                c4 = parent.getComponent(componentIndex + 4);
                c4.setBounds(rowX[5], rowY + (this.rowHeights[rowIndex] - c4.getPreferredSize().height) / 2,
                        this.columnWidths[5], c4.getPreferredSize().height);
                componentIndex = componentIndex + 5;
                break;
            case FormatLayout.LCBLCB:
                c0 = parent.getComponent(componentIndex);
                c0.setBounds(rowX[0], rowY + (this.rowHeights[rowIndex] - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height);
                c1 = parent.getComponent(componentIndex + 1);
                c1.setBounds(rowX[1], rowY + (this.rowHeights[rowIndex] - c1.getPreferredSize().height) / 2,
                        this.columnWidths[1], c1.getPreferredSize().height);
                c2 = parent.getComponent(componentIndex + 2);
                c2.setBounds(rowX[2], rowY + (this.rowHeights[rowIndex] - c2.getPreferredSize().height) / 2,
                        this.columnWidths[2], c2.getPreferredSize().height);
                c3 = parent.getComponent(componentIndex + 3);
                c3.setBounds(rowX[3], rowY + (this.rowHeights[rowIndex] - c3.getPreferredSize().height) / 2,
                        this.columnWidths[3], c3.getPreferredSize().height);
                c4 = parent.getComponent(componentIndex + 4);
                c4.setBounds(rowX[4], rowY + (this.rowHeights[rowIndex] - c4.getPreferredSize().height) / 2,
                        this.columnWidths[4], c4.getPreferredSize().height);
                c5 = parent.getComponent(componentIndex + 5);
                c5.setBounds(rowX[5], rowY + (this.rowHeights[rowIndex] - c5.getPreferredSize().height) / 2,
                        this.columnWidths[5], c5.getPreferredSize().height);
                componentIndex = componentIndex + 6;
                break;
            }
            rowY = rowY + this.rowHeights[rowIndex] + this.rowGap;
        }
    }
}