@Override
    public int getPreferredHeight(int width) {
      int height = 0;
      for (Component c: getComponents()) {
        height += WidthBasedLayout.getPreferredHeight(c, width);
      }
      return height;
    }
@Override
    public int getPreferredHeight(int width)