void (Graphics g, JComponent c) { ToolbarComboWidget combo = (ToolbarComboWidget)c; paintBackground(g, combo); List<Icon> leftIcons = combo.getLeftIcons(); List<Icon> rightIcons = combo.getRightIcons(); Rectangle innerArea = SwingUtilities.calculateInnerArea(c, null); Graphics2D g2 = (Graphics2D)g.create(innerArea.x, innerArea.y, innerArea.width, innerArea.height); Rectangle paintRect = new Rectangle(0, 0, innerArea.width, innerArea.height); int maxTextWidth = calcMaxTextWidth(combo, paintRect); try { GraphicsUtil.setupAAPainting(g2); boolean skipNextGap = false; if (!leftIcons.isEmpty()) { Rectangle iconsRect = paintIcons(leftIcons, combo, g2, paintRect, combo.getLeftIconsGap()); doClip(paintRect, iconsRect.width + getGapAfterLeftIcons()); skipNextGap = true; } String text = getText(combo); if (!StringUtil.isEmpty(text) && maxTextWidth > 0) { Rectangle textRect = new Rectangle(paintRect.x, paintRect.y, maxTextWidth, paintRect.height); drawText(c, text, g2, textRect); doClip(paintRect, maxTextWidth); skipNextGap = false; } if (!rightIcons.isEmpty()) { if (!skipNextGap) doClip(paintRect, getGapBeforeRightIcons()); Rectangle iconsRect = paintIcons(rightIcons, combo, g2, paintRect, combo.getRightIconsGap()); doClip(paintRect, iconsRect.width); skipNextGap = false; } if (isSeparatorShown(combo)) { doClip(paintRect, getSeparatorGap()); g2.setColor(c.isEnabled() ? UIManager.getColor("MainToolbar.separatorColor") : UIUtil.getLabelDisabledForeground()); g2.fillRect(paintRect.x, ((int)paintRect.getCenterY()) - SEPARATOR_HEIGHT / 2, SEPARATOR_WIDTH, SEPARATOR_HEIGHT); separatorPosition = paintRect.x + combo.getInsets().left; doClip(paintRect, SEPARATOR_WIDTH + getSeparatorGap()); skipNextGap = false; } if (combo.isExpandable()) { if (!skipNextGap) doClip(paintRect, getGapBeforeExpandIcon()); paintIcons(Collections.singletonList(EXPAND_ICON), combo, g2, paintRect, 0); // no gap for single icon } } finally { g2.dispose(); } }