int globalXPadding = computeXPadding(w, totalWidth, new MaximalGridLayoutConstraints(position));
globalXPadding += bounds.x;
int globalYPadding = computeYPadding(h, totalHeight, new MaximalGridLayoutConstraints(position));
globalYPadding += bounds.y;
for (int i = 0 ; i < nComps ; i++) {
ISahitsComponent c = parent.get(i);
final int columnIndex = computeColumnIndex(i);
final int rowIndex = computeRowIndex(i);
int xColumn = (int) Math.rint(getColumnStart(columnIndex,parent)*widthScale);
xColumn += (columnIndex-1)*gap;
int yRow = (int) Math.rint(getRowStart(rowIndex,parent)*heightScale);
yRow += (rowIndex-1)*gap;
final int columnWidth = (int) Math.rint(computeWidth(columnIndex, parent)*widthScale);
final int rowHeight = (int) Math.rint(computeHeight(rowIndex, parent)*heightScale);
Dimension d = c.getPreferredSize();
d.width = Math.min(d.width,columnWidth);
d.height = Math.min(d.height,rowHeight);
final int xPadding = computeXPadding(columnWidth,d.width,getConstraints(c));
final int yPadding = computeYPadding(rowHeight,d.height,getConstraints(c));
// increase x and y, if appropriate
final int x = insets.left+xColumn+xPadding+globalXPadding;
final int y = insets.top+yRow+yPadding+globalYPadding;
// Set the ISahitsComponent's size and position.
c.setBounds(x, y, d.width, d.height);
}
resetSizeCache();
}