d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap;
d.width += checkIcon.getIconWidth() + defaultTextIconGap;
  protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,                                               Icon arrowIcon,                                               int defaultTextIconGap)  {    JMenuItem m = (JMenuItem) c;    Dimension d = BasicGraphicsUtils.getPreferredButtonSize(m,                                                            defaultTextIconGap);    // if menu item has accelerator then take accelerator's size into account    // when calculating preferred size.    KeyStroke accelerator = m.getAccelerator();    Rectangle rect;    if (accelerator != null)      {        rect = getAcceleratorRect(                                  accelerator,                                  m.getToolkit().getFontMetrics(acceleratorFont));        // add width of accelerator's text        d.width += rect.width + defaultAcceleratorLabelGap;        // adjust the heigth of the preferred size if necessary        if (d.height < rect.height)          d.height = rect.height;      }    if (checkIcon != null)      {        d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap;        if (checkIcon.getIconHeight() > d.height)          d.height = checkIcon.getIconHeight();      }    if (arrowIcon != null && (c instanceof JMenu))      {        if (!((JMenu) c).isTopLevelMenu())          // It is a MenuItem          d.width += arrowIcon.getIconWidth() + m.getParent().getWidth();        else          // It is a Menu, no arrowIcon painted.          d.width += MenuGap;        if (arrowIcon.getIconHeight() > d.height)          d.height = arrowIcon.getIconHeight();      }    return d;  }