Dimension (JComponent comp) { checkArrowIcon(); JMenuItem jmenuitem = (JMenuItem)comp; Icon icon1 = getIcon(); Icon icon2 = getAllowedIcon(); checkEmptyIcon(comp); String text = jmenuitem.getText(); String keyStrokeText = getKeyStrokeText(jmenuitem); Font font = jmenuitem.getFont(); FontMetrics fontmetrics = comp.getFontMetrics(font); FontMetrics fontmetrics1 = comp.getFontMetrics(acceleratorFont); initBounds(); layoutMenuItem(fontmetrics, text, fontmetrics1, keyStrokeText, icon1, icon2, arrowIcon, jmenuitem.getVerticalAlignment(), jmenuitem.getHorizontalAlignment(), jmenuitem.getVerticalTextPosition(), jmenuitem.getHorizontalTextPosition(), f, l, j, c, h, d, text != null ? defaultTextIconGap : 0, defaultTextIconGap); Rectangle i = new Rectangle(); i.setBounds(j); SwingUtilities.computeUnion(l.x, l.y, l.width, l.height, i); if (!(keyStrokeText == null || keyStrokeText.isEmpty())){ i.width += c.width; i.width += 7 * defaultTextIconGap; } if (useCheckAndArrow()){ i.width += myMaxGutterIconWidth; i.width += defaultTextIconGap; i.width += defaultTextIconGap; i.width += d.width; } i.width += 2 * defaultTextIconGap; Insets insets = jmenuitem.getInsets(); if (insets != null){ i.width += insets.left + insets.right; i.height += insets.top + insets.bottom; } if (i.width % 2 == 0){ i.width++; } if (i.height % 2 == 0){ i.height++; } return IdeaMenuUI.patchPreferredSize(comp, i.getSize()); }