/* RenduListeUsers.java */package com.furtyirc.utils;import javax.swing.*;import java.awt.*;public class RenduListeUsers extends JLabel implements ListCellRenderer{ final static ImageIcon green = new ImageIcon("../../../../ressources/green.tiff"); final static ImageIcon yellow = new ImageIcon("../../../../ressources/yellow.tiff"); final static ImageIcon red = new ImageIcon("../../../../ressources/red.tiff"); final static ImageIcon purple = new ImageIcon("../../../../ressources/purple.tiff"); // This is the only method defined by ListCellRenderer. // We just reconfigure the JLabel each time we're called. public Component getListCellRendererComponent( JList list, Object value, // value to display int index, // cell index boolean isSelected, // is the cell selected boolean cellHasFocus) // the list and the cell have the focus { String s = value.toString(); setText(s); setIcon(green); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setEnabled(list.isEnabled()); setFont(list.getFont()); setOpaque(true); return this; } }