list.setCellRenderer(new ListCellRenderer()
{
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
{
@SuppressWarnings({"unchecked"})
final JComponent comp = new JBLabel(((JSVariable) value).getName());
comp.setOpaque(true);
if (isSelected)
{
comp.setBackground(list.getSelectionBackground());
comp.setForeground(list.getSelectionForeground());
}
else
{
comp.setBackground(list.getBackground());
comp.setForeground(list.getForeground());
}
return comp;
}
});