JComboBox – UI Modifications


Change Popup Arrow

jComboBox1.setUI(new SynthComboBoxUI() {
    @Override
    protected JButton createArrowButton() {
        JButton button = super.createArrowButton();
        JButton newButton = new JButton("<>");
        newButton.setOpaque(true);
        newButton.setBackground(Color.GREEN);
        newButton.setName("ComboBox.arrowButton");
        newButton.setModel(button.getModel());
        return newButton;
    }
});

Reset:
    jComboBox1.setUI(new SynthComboBoxUI());

Note:
    Depends on the UI you are using (in this case Synth)

Set Padding

jComboBox1.setUI(new SynthComboBoxUI() {
    @Override
    protected void installDefaults() {
        super.installDefaults();
        this.padding = new Insets(20, 20, 20, 20);
    }
});
Reset:
    jComboBox1.setUI(new SynthComboBoxUI());

Note:
    Depends on the UI you are using (in this case Synth)