if (!((JMenu)c).isTopLevelMenu()) { JMenuItem menuItem = new JMenuItem(((JMenu)c).getText(), ((JMenu)c).getIcon()); return menuItem.getMaximumSize(); }
  public Dimension getMaximumSize(JComponent c)  {    return c.getPreferredSize();  }