component.setBounds(info.pos_x + x, info.pos_y + y, dim.width, dim.height);
component.setBounds(info.pos_x + x, info.pos_y + y, dim.width, dim.height); lastComp = component;
    protected void ArrangeGrid (Container parent)    {      Component[] components = parent.getComponents();      if (components.length == 0)        return;      GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);      if (info.cols == 0 && info.rows == 0)        return;      // DEBUG      //dumpLayoutInfo (info);          // Calling setBounds on these components causes this layout to      // be invalidated, clearing the layout information cache,      // layoutInfo.  So we wait until after this for loop to set      // layoutInfo.      for(int i = 0; i < components.length; i++)	{          Component component = components [i];		          // If component is not visible we dont have to care about it.          if (!component.isVisible())            continue;		          GridBagConstraints constraints =              lookupInternalConstraints(component);          int cellx = sumIntArray(info.colWidths, constraints.gridx);          int celly = sumIntArray(info.rowHeights, constraints.gridy);          int cellw = sumIntArray(info.colWidths,                                  constraints.gridx + constraints.gridwidth) - cellx;          int cellh = sumIntArray(info.rowHeights,                                  constraints.gridy + constraints.gridheight) - celly;          Insets insets = constraints.insets;          if (insets != null)	    {              cellx += insets.left;              celly += insets.top;              cellw -= insets.left + insets.right;              cellh -= insets.top + insets.bottom;	    }          Dimension dim = component.getPreferredSize();          // Note: Documentation says that padding is added on both sides, but          // visual inspection shows that the Sun implementation only adds it          // once, so we do the same.          dim.width += constraints.ipadx;          dim.height += constraints.ipady;          switch(constraints.fill)	    {            case GridBagConstraints.HORIZONTAL:              dim.width = cellw;              break;            case GridBagConstraints.VERTICAL:              dim.height = cellh;              break;            case GridBagConstraints.BOTH:              dim.width = cellw;              dim.height = cellh;              break;	    }          int x;          int y;          switch(constraints.anchor)	    {            case GridBagConstraints.NORTH:              x = cellx + (cellw - dim.width) / 2;              y = celly;              break;            case GridBagConstraints.SOUTH:              x = cellx + (cellw - dim.width) / 2;              y = celly + cellh - dim.height;              break;            case GridBagConstraints.WEST:              x = cellx;              y = celly + (cellh - dim.height) / 2;              break;            case GridBagConstraints.EAST:              x = cellx + cellw - dim.width;              y = celly + (cellh - dim.height) / 2;              break;            case GridBagConstraints.NORTHEAST:              x = cellx + cellw - dim.width;              y = celly;              break;            case GridBagConstraints.NORTHWEST:              x = cellx;              y = celly;              break;            case GridBagConstraints.SOUTHEAST:              x = cellx + cellw - dim.width;              y = celly + cellh - dim.height;              break;            case GridBagConstraints.SOUTHWEST:              x = cellx;              y = celly + cellh - dim.height;              break;            default:              x = cellx + (cellw - dim.width) / 2;              y = celly + (cellh - dim.height) / 2;              break;	    }          component.setBounds(info.pos_x + x, info.pos_y + y, dim.width, dim.height);	}      // DEBUG      //dumpLayoutInfo (info);      // Cache layout information.      layoutInfo = getLayoutInfo (parent, PREFERREDSIZE);    }