arrangeGrid (parent);
Component[] components = parent.getComponents();  if (components.length == 0) return;  GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE); if (info.cols == 0 && info.rows == 0) return; layoutInfo = info;     for(int i = 0; i < components.length; i++) { Component component = components [i];   if (!component.isVisible()) continue;  GridBagConstraints constraints = lookupConstraints (component);  int cellx = sumIntArray(layoutInfo.colWidths, constraints.gridx); int celly = sumIntArray(layoutInfo.rowHeights, constraints.gridy); int cellw = sumIntArray(layoutInfo.colWidths, constraints.gridx + constraints.gridwidth) - cellx; int cellh = sumIntArray(layoutInfo.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();     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(layoutInfo.pos_x + x, layoutInfo.pos_y + y, dim.width, dim.height); }
    protected void ArrangeGrid (Container parent)    {	arrangeGrid (parent);    }