private void doPaint(Graphics g) { GraphicsUtil.setupAntialiasing(g); final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText()); final Dimension size = getSize(); if (isSmallVariant()) { final Graphics2D g2 = (Graphics2D) g; g2.setColor(UIUtil.getControlColor()); final int w = getWidth(); final int h = getHeight(); if (getModel().isArmed() && getModel().isPressed()) { g2.setPaint( new GradientPaint( 0, 0, UIUtil.getControlColor(), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.8))); } else { g2.setPaint( new GradientPaint( 0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.9))); } g2.fillRect(2, 0, w - 2, h); GraphicsUtil.setupAntialiasing(g2); if (!myMouseInside) { g2.setPaint( new GradientPaint( 0, 0, UIUtil.getBorderColor(), 0, h, UIUtil.getBorderColor().darker())); // g2.setColor(UIUtil.getBorderColor()); } else { g2.setPaint( new GradientPaint( 0, 0, UIUtil.getBorderColor().darker(), 0, h, UIUtil.getBorderColor().darker().darker())); } g2.drawRect(2, 0, w - 3, h - 1); final Icon icon = getIcon(); int x = 7; if (icon != null) { icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2); x += icon.getIconWidth() + 3; } if (!StringUtil.isEmpty(getText())) { final Font font = getFont(); g2.setFont(font); g2.setColor(UIManager.getColor("Panel.foreground")); g2.drawString(getText(), x, (size.height + font.getSize()) / 2 - 1); } } else { super.paintComponent(g); } final Insets insets = super.getInsets(); final Icon icon = isEnabled() ? ARROW_ICON : DISABLED_ARROW_ICON; final int x; if (isEmpty) { x = (size.width - icon.getIconWidth()) / 2; } else { if (isSmallVariant()) { x = size.width - icon.getIconWidth() - insets.right + 1; } else { x = size.width - icon.getIconWidth() - insets.right + (UIUtil.isUnderNimbusLookAndFeel() ? -3 : 2); } } if (UIUtil.isUnderDarcula()) { g.setXORMode(new Color(208, 188, 159)); } icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2); g.setPaintMode(); }