void (final LayoutManager layout) { // some components (for example, JXCollapsiblePanel from SwingX) have asymmetrical getLayout/setLayout - a different // layout is returned compared to what was passed to setLayout(). to avoid crashes, we store the layout we passed to // the component. myDelegeeLayout = layout; getDelegee().setLayout(layout); if (layout instanceof AbstractLayout aLayout) { for (int i = 0; i < getComponentCount(); i++) { final RadComponent c = getComponent(i); aLayout.addLayoutComponent(c.getDelegee(), c.getConstraints()); } } }