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

void com::jgoodies::forms::layout::FormLayout::layoutComponents ( int[]  x,
int[]  y 
) [inline, private]

Lays out the components using the given x and y origins, the column and row specifications, and the component constraints.

The actual computation is done by each component's form constraint object. We just compute the cell, the cell bounds and then hand over the component, cell bounds, and measure to the form constraints. This will allow potential subclasses of CellConstraints to do special micro-layout corrections. For example, such a subclass could map JComponent classes to visual layout bounds that may lead to a slightly different bounds.

x an int array of the horizontal origins
y an int array of the vertical origins

Definition at line 1229 of file FormLayout.java.

References constraintMap, com::jgoodies::forms::layout::CellConstraints::gridHeight, com::jgoodies::forms::layout::CellConstraints::gridWidth, com::jgoodies::forms::layout::CellConstraints::gridX, com::jgoodies::forms::layout::CellConstraints::gridY, minimumWidthMeasure, and com::jgoodies::forms::layout::CellConstraints::setBounds().

Referenced by layoutContainer().

        Rectangle cellBounds = new Rectangle();
        for (Iterator i = constraintMap.entrySet().iterator(); i.hasNext(); ) {
            Map.Entry entry = (Map.Entry) i.next();
            Component       component   = (Component)       entry.getKey();
            CellConstraints constraints = (CellConstraints) entry.getValue();
            int gridX      = constraints.gridX-1;
            int gridY      = constraints.gridY-1;
            int gridWidth  = constraints.gridWidth;
            int gridHeight = constraints.gridHeight;
            cellBounds.x = x[gridX];
            cellBounds.y = y[gridY];
            cellBounds.width  = x[gridX + gridWidth ] - cellBounds.x;
            cellBounds.height = y[gridY + gridHeight] - cellBounds.y;

            constraints.setBounds(component, this, cellBounds,
                            minimumWidthMeasure,   minimumHeightMeasure, 
                            preferredWidthMeasure, preferredHeightMeasure);

Generated by  Doxygen 1.6.0   Back to index