Here is my code. It does not show images in the frame and instead shows some text. would anybody please suggest me that what change I should make in the code so that it all
you can use listcellrenderer to display both image and text in jlist probably like the one below for showing label with icon in list
public class myRenderer extends DefaultListCellRenderer
{
@Override
public Component getListCellRendererComponent(JList list, Object value, int index,boolean isSelected, boolean cellHasFocus)
{
//JLabel l = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if(value instanceof JLabel)
{
this.setText(((JLabel)value).getText());
this.setIcon(((JLabel)value).getIcon());
}
return this;
}
}