@Override
 public Dimension minimumLayoutSize(Container parent) {
   Component toolbar = parent.getComponent(0);
   Dimension toolbarSize = toolbar.isVisible() ? toolbar.getMinimumSize() : new Dimension();
   Dimension contentSize = parent.getComponent(1).getMinimumSize();
   return new Dimension(
       Math.max(toolbarSize.width, contentSize.width), toolbarSize.height + contentSize.height);
 }
    public Dimension getPreferredSize() {
      int width = 0;
      int height = 0;

      if (myRootComponent != null) {
        width = Math.max(width, (int) myRootComponent.getBounds().getMaxX());
        height = Math.max(height, (int) myRootComponent.getBounds().getMaxY());

        for (RadComponent component : myRootComponent.getChildren()) {
          width = Math.max(width, (int) component.getBounds().getMaxX());
          height = Math.max(height, (int) component.getBounds().getMaxY());
        }
      }

      width += 50;
      height += 40;

      Rectangle bounds = myScrollPane.getViewport().getBounds();

      return new Dimension(Math.max(width, bounds.width), Math.max(height, bounds.height));
    }