aLabel.setBackground(list.getSelectionBackground()); aLabel.setForeground(list.getSelectionForeground());
setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground());
    public Component getListCellRendererComponent(            JList list,            Object value,            int index,            boolean isSelected,            boolean cellHasFocus) {        JLabel aLabel = null;        aLabel = new JLabel();        aLabel.setFont(list.getFont());        aLabel.setOpaque(true);        if (value != null) {            String inhalt = (String) value;            aLabel.setText(inhalt);            if (isSelected) {                aLabel.setBackground(list.getSelectionBackground());                aLabel.setForeground(list.getSelectionForeground());            }            else {                aLabel.setForeground(list.getForeground());                if (inhalt.substring(0, 1).compareTo("!") == 0) {                    aLabel.setBackground(Color.RED);                }                else if (inhalt.substring(0, 1).compareTo("@") == 0) {                    aLabel.setBackground(Color.YELLOW);                }                else if (inhalt.substring(0, 1).compareTo("%") == 0) {                    aLabel.setBackground(Color.GREEN);                }                else if (inhalt.substring(0, 1).compareTo("+") == 0) {                    aLabel.setBackground(Color.LIGHT_GRAY);                }                else {                    aLabel.setBackground(list.getBackground());                }            }        }        return aLabel;    }