Possible Duplicate:
Java:Add an image to a JList item
public class ClientUserPanel extends JPanel {
private JList userlist;
private JScrollPane scrollist;
private DefaultListModel listmodel;
public ClientUserPanel() {
super();
init();
}
private void init() {
this.setLayout(new BorderLayout());
this.setSize(100, 200);
listmodel = new DefaultListModel();
userlist = new JList(listmodel);
scrollist = new JScrollPane(userlist);
listmodel.addElement("uday");
listmodel.addElement("ravi");
listmodel.addElement("uday");
this.add(scrollist, BorderLayout.CENTER);
}
}
Here I have a JList and i had added items to the list and its working correctly, but i want to add an icon in JList beside each item . for example to show the status of user,either he was offline or online. can any one please help me