I have a jlist that uses an ImageListCellRenderer. I create an icon and pass it an image. Then I attempt to do setListData. Everything compiles fine but no image is displayed.


Here is where I set the ImageListCellRenderer()

Code:
musicListBox.setCellRenderer(new ImageListCellRenderer());
Code:
class ImageListCellRenderer implements ListCellRenderer
{
	  
	   
	  public Component getListCellRendererComponent(JList jlist, 
	                                                Object value, 
	                                                int cellIndex, 
	                                                boolean isSelected, 
	                                                boolean cellHasFocus)
	  {
		  
	    if (value instanceof JPanel)
	    {
	      Component component = (Component) value;
	      component.setForeground (Color.white);
	      component.setBackground (Color.white);
	      return component;
	    }
	    else
	    {
	    	return new JLabel("???");
	    }
	  }
}
Here is where I set the image Icon info

Code:
logoIcon = (new ImageIcon("C:\\Users\\mfierro\\Desktop\\crs471\\SourceCode\\Solution - ex71\\images\\" + getImgName()));
		System.out.println(logoIcon);
		logoLabel = new JLabel(logoIcon,JLabel.CENTER) ;
		logoPanel = new JPanel();
		logoPanel.add(logoLabel);
Here is the getImgName() method
Code:
public String getImgName(){
		
        String imgName = "";

         if(MainFrame.sel == 0){
	imgName = "snes.jpg";
                return imgName;
         }
        if(MainFrame.sel == 1){
                 imgName = "nes.jpg";
                 return imgName; 
        }
     	
        else{
     	return imgName;
        }
Here is where I setListData
Code:
musicListBox.setListData(getPanel().toArray());
Code:
Here is the getPanel() method 
public ArrayList<Object>getPanel(){
		
           ArrayList<Object> obj = new ArrayList<Object>();
	
	
           Object item = (String) getImgName();
           obj.add(item);
           return obj;
}
Any idea why I am not seeing the image?