I\'m using a JList as part of a wizard to display all the steps to be performed (it also allows clicking on a step to go to it). Some steps will not always be needed, based
I wanted a JList with cells that couldn't be select AND were transparent. So here's what I did:
class DisabledItemListCellRenderer extends JLabel implements ListCellRenderer { private static final long serialVersionUID = 1L; public DisabledItemListCellRenderer() { setOpaque(false); } @Override public Component getListCellRendererComponent(JList> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String txt = (String) value; setText(txt); return this; } }