void (final DimensionInfo info, final boolean min, final int[] widths) { for(int i=info.getComponentCount() - 1; i >= 0; i--) { Component child = info.getComponent(i); GridConstraints c = info.getConstraints(i); if (c.isUseParentLayout() && child instanceof Container) { Container container = (Container) child; if (container.getLayout() instanceof GridLayoutManager) { updateSizesFromChild(info, min, widths, container, i); } else if (container.getComponentCount() == 1 && container.getComponent(0) instanceof Container) { // "use parent layout" also needs to work in cases where a grid is the only control in a non-grid panel // which is contained in a grid Container childContainer = (Container) container.getComponent(0); if (childContainer.getLayout() instanceof GridLayoutManager) { updateSizesFromChild(info, min, widths, childContainer, i); } } } } }