Code example for JList

Methods: getBackgroundgetForeground

0
            boolean cellHasFocus) {
        if (isSelected) {
            setBackground(list.getSelectionBackground());
            setForeground(list.getSelectionForeground());
        } else { 
            setBackground(list.getBackground());
            setForeground(list.getForeground());
        } 
        ImageIcon icon = (ImageIcon) value;
        setText(icon.getDescription());
        setIcon(icon);
        return this;
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java