public void paintIcon(Component c, Graphics g, int x, int y) { boolean enabled = c.isEnabled(); // paint the icon Icon paintedIcon = enabled ? icon : disabledIcon; if (paintedIcon != null) paintedIcon.paintIcon(c, g, x, y); // backup current color Color oldColor = g.getColor(); int insetx = 4; if (c instanceof JComponent) { Insets borderinset = ((JComponent) c).getBorder().getBorderInsets(c); insetx = borderinset.left; } if (paintedIcon != null) { g.translate(paintedIcon.getIconWidth() + X_GAP + insetx, 0); } arrow.paintIcon(c, g, x, y); if (paintedIcon != null) { g.translate(-paintedIcon.getIconWidth() - X_GAP - insetx, 0); } // restore previous color g.setColor(oldColor); }
public int getIconHeight() { int height = arrow.getIconHeight(); if (icon != null) height = Math.max(icon.getIconHeight(), height); return height; }
public int getIconWidth() { int width = arrow.getIconWidth(); if (icon != null) width += icon.getIconWidth(); width += X_GAP; return width; }