tags:

views:

226

answers:

2

this is my code:

URL imageUrl = status.getUser().getProfileImageURL();
ImageIcon tivitImage = new ImageIcon(imageUrl);
listModel.addElement(tivitImage.getImage());  // maybe this part is wrong
+1  A: 

You could subclass JList or use your own ListCellRenderer, as it is shown in this article.

Another reading: http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JList.html, towards the end, a jlist with country flags is explained.

The MYYN
You don't have to subclass JList though, you can just set the cell renderer via jList.setCellRenderer(cellRenderer);
+2  A: 
listModel.addElement(tivitImage.getImage()); // maybe this part is wrong

Yes, thats the problem. Just add the Icon to the ListModel (not the image). JList supports a default renderer for Icons.

camickr