void (Graphics g, JComponent comp) { checkArrowIcon(); UISettings.setupAntialiasing(g); JMenuItem jmenuitem = (JMenuItem)comp; ButtonModel buttonmodel = jmenuitem.getModel(); int mnemonicIndex = jmenuitem.getDisplayedMnemonicIndex(); Icon icon1 = getIcon(); Icon icon2 = getAllowedIcon(); checkEmptyIcon(comp); int j1 = jmenuitem.getWidth(); int k1 = jmenuitem.getHeight(); Insets insets = comp.getInsets(); initBounds(); f.setBounds(0, 0, j1, k1); JBInsets.removeFrom(f, insets); Font font = g.getFont(); Font font1 = comp.getFont(); g.setFont(font1); FontMetrics fontmetrics = g.getFontMetrics(font1); FontMetrics fontmetrics1 = g.getFontMetrics(acceleratorFont); String keyStrokeText = getKeyStrokeText(jmenuitem); String s1 = layoutMenuItem(fontmetrics, jmenuitem.getText(), fontmetrics1, keyStrokeText, icon1, icon2, arrowIcon, jmenuitem.getVerticalAlignment(), jmenuitem.getHorizontalAlignment(), jmenuitem.getVerticalTextPosition(), jmenuitem.getHorizontalTextPosition(), f, l, j, c, h, d, jmenuitem.getText() != null ? defaultTextIconGap : 0, defaultTextIconGap); Color color2 = g.getColor(); if (comp.isOpaque()) { g.setColor(jmenuitem.getBackground()); g.fillRect(0, 0, j1, k1); if (isSelected(jmenuitem)) { g.setColor(selectionBackground); if (ExperimentalUI.isNewUI() || IdeaPopupMenuUI.isRoundBorder()) { IdeaMenuUI.paintRoundSelection(g, comp, j1, k1); } else { g.fillRect(0, 0, j1, k1); } } g.setColor(color2); } if (icon2 != null){ if (isSelected(jmenuitem)) { g.setColor(selectionForeground); } else { g.setColor(jmenuitem.getForeground()); } if (useCheckAndArrow()) { IconUtil.paintSelectionAwareIcon(icon2, jmenuitem, g, h.x, h.y, isSelected(jmenuitem)); } g.setColor(color2); if (menuItem.isArmed()) { drawIconBorder(g); } } if (icon1 != null) { if (!buttonmodel.isEnabled()){ icon1 = jmenuitem.getDisabledIcon(); } else if (buttonmodel.isPressed() && buttonmodel.isArmed()) { icon1 = jmenuitem.getPressedIcon(); if (icon1 == null){ icon1 = jmenuitem.getIcon(); } } if (icon1 != null) { IconUtil.paintSelectionAwareIcon(icon1, jmenuitem, g, l.x, l.y, isSelected(jmenuitem)); } } if (s1 != null && s1.length() > 0) { if (buttonmodel.isEnabled()) { if (isSelected(jmenuitem)) { g.setColor(selectionForeground); } else{ g.setColor(jmenuitem.getForeground()); } BasicGraphicsUtils.drawStringUnderlineCharAt(g, s1, mnemonicIndex, j.x, j.y + fontmetrics.getAscent()); } else { final Object disabledForeground = UIUtil.getMenuItemDisabledForegroundObject(); if (disabledForeground instanceof Color){ g.setColor((Color)disabledForeground); BasicGraphicsUtils.drawStringUnderlineCharAt(g, s1, mnemonicIndex, j.x, j.y + fontmetrics.getAscent()); } else{ g.setColor(jmenuitem.getBackground().brighter()); BasicGraphicsUtils.drawStringUnderlineCharAt(g, s1, mnemonicIndex, j.x, j.y + fontmetrics.getAscent()); g.setColor(jmenuitem.getBackground().darker()); BasicGraphicsUtils.drawStringUnderlineCharAt(g, s1, mnemonicIndex, j.x - 1, (j.y + fontmetrics.getAscent()) - 1); } } } if (keyStrokeText != null && !keyStrokeText.isEmpty()) { g.setFont(acceleratorFont); if (buttonmodel.isEnabled()){ if (UIUtil.isUnderAquaBasedLookAndFeel() && isSelected(jmenuitem)) { g.setColor(selectionForeground); } else { if (isSelected(jmenuitem)) { g.setColor(acceleratorSelectionForeground); } else { g.setColor(acceleratorForeground); } } BasicGraphicsUtils.drawString(g, keyStrokeText, 0, c.x, c.y + fontmetrics1.getAscent()); } else if (disabledForeground != null) { g.setColor(disabledForeground); BasicGraphicsUtils.drawString(g, keyStrokeText, 0, c.x, c.y + fontmetrics1.getAscent()); } else { g.setColor(jmenuitem.getBackground().brighter()); BasicGraphicsUtils.drawString(g, keyStrokeText, 0, c.x, c.y + fontmetrics1.getAscent()); g.setColor(jmenuitem.getBackground().darker()); BasicGraphicsUtils.drawString(g, keyStrokeText, 0, c.x - 1, (c.y + fontmetrics1.getAscent()) - 1); } } if (arrowIcon != null) { if (isSelected(jmenuitem)) { g.setColor(selectionForeground); } if (useCheckAndArrow()){ IconUtil.paintSelectionAwareIcon(arrowIcon, comp, g, d.x, d.y, isSelected(jmenuitem)); } } g.setColor(color2); g.setFont(font); }