I have this code in a ListCellRenderer which extends JEditorPane. The editor pane doesn't show the image, but instead shows a 'broken icon'. What's wrong with it?
public class TweetCellRenderer extends JEditorPane implements ListCellRenderer {
public Component getListCellRendererComponent(
javax.swing.JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus
) {
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 6));
StringBuffer sb = new StringBuffer();
setContentType("text/html");
sb.append("<html><body>");
sb.append("<img src='http://www.google.co.uk/images/firefox/video.png' />");
sb.append("</body></html>");
System.out.println(sb);
setText(sb.toString());
setBackground(isSelected ? SELECTED_BG : BG);
setForeground(isSelected ? SELECTED_FG : FG);
return this;
}
}