Insets comboInsets = comboBox.getInsets(); if (editor instanceof JComponent) { Insets editorInsets = ((JComponent) editor).getInsets(); d.height += editorInsets.top + editorInsets.bottom; }
  public Dimension getMinimumSize(JComponent c)  {    if (!isMinimumSizeDirty)      return new Dimension(cachedMinimumSize);    Dimension d;    if (!comboBox.isEditable() && arrowButton != null        && arrowButton instanceof MetalComboBoxButton)      {    MetalComboBoxButton b = (MetalComboBoxButton) arrowButton;        d = getDisplaySize();    Insets insets = b.getInsets();        Insets arrowInsets = b.getInsets();        Insets comboInsets = comboBox.getInsets();        Icon icon = b.getComboIcon();        d.width += comboInsets.left + comboInsets.right;        d.width += arrowInsets.left + arrowInsets.right;        d.width += arrowInsets.right + icon.getIconWidth();        d.height += comboInsets.top + comboInsets.bottom;        d.height += arrowInsets.top + arrowInsets.bottom;      }    else if (comboBox.isEditable() && arrowButton != null && editor != null)      {        d = super.getMinimumSize(c);        Insets arrowMargin = arrowButton.getMargin();        Insets comboInsets = comboBox.getInsets();        if (editor instanceof JComponent)          {            Insets editorInsets = ((JComponent) editor).getInsets();            d.height += editorInsets.top + editorInsets.bottom;          }        d.height += arrowMargin.top + arrowMargin.bottom;        d.height += comboInsets.top + comboInsets.bottom;      }    else      {        d = super.getMinimumSize(c);      }    cachedMinimumSize.setSize(d.width, d.height);    isMinimumSizeDirty = false;    return new Dimension(cachedMinimumSize);  }