@Override
 public void layoutContainer(Container parent) {
   int width = parent.getWidth();
   int height = parent.getHeight();
   Component toolbar = parent.getComponent(0);
   Dimension toolbarSize = toolbar.isVisible() ? toolbar.getPreferredSize() : new Dimension();
   toolbar.setBounds(0, 0, width, toolbarSize.height);
   parent.getComponent(1).setBounds(0, toolbarSize.height, width, height - toolbarSize.height);
 }
 public void doLayout() {
   for (int i = getComponentCount() - 1; i >= 0; i--) {
     Component component = getComponent(i);
     component.setBounds(0, 0, getWidth(), getHeight());
   }
 }