Same issue, I did this in order to customize it for showing icons:
private static class CustomComboBoxRenderer extends DefaultListCellRenderer
{
private final ListCellRenderer backend;
public CustomComboBoxRenderer(ListCellRenderer backend)
{
this.backend = backend;
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
{
Component component = backend.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if(component instanceof JLabel == false)
component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
JLabel label = (JLabel)component;
label.setIcon(Icons.COMPONENT);
return label;
}
}
Then assigned the renderer like this:
comboBox.setRenderer(new CustomComboBoxRenderer(comboBox.getRenderer()));
This has worked out fine for me, so far.