How can I change the arrow style in a JComboBox

You can override createArrowButton() in BasicComboBoxUI. BasicArrowButton is a convenient starting point.

class ColorArrowUI extends BasicComboBoxUI {

    public static ComboBoxUI createUI(JComponent c) {
        return new ColorArrowUI();
    }

    @Override protected JButton createArrowButton() {
        return new BasicArrowButton(
            BasicArrowButton.SOUTH,
            Color.cyan, Color.magenta,
            Color.yellow, Color.blue);
    }
}

Then install it.

JComboBox combo = new JComboBox();
combo.setUI(ColorArrowUI.createUI(combo));

Leave a Comment