Dimension contentPrefSize = contentPane.getPreferredSize();
Dimension contentPrefSize = getContentPane().getPreferredSize();
    public Dimension preferredLayoutSize(Container c)    {      Dimension prefSize = new Dimension();              Insets i = getInsets();              prefSize = new Dimension(i.left + i.right, i.top + i.bottom);              Dimension contentPrefSize = contentPane.getPreferredSize();              prefSize.width += contentPrefSize.width;              prefSize.height += contentPrefSize.height;          if (menuBar != null)            {                  Dimension menuBarSize = menuBar.getPreferredSize();                  if (menuBarSize.width > contentPrefSize.width)                    prefSize.width += menuBarSize.width - contentPrefSize.width;                  prefSize.height += menuBarSize.height;            }      return prefSize;    }