I have a JList and a DefaultListModel, created like this:
I didn't use the <> for the classes. I want to know how I can (if I can) have an element in the list which has a String and GreenfootImage in it.
Right now I'm adding things into the list like this:
Just doing this:
shows "greenfoot.GreenfootImage@<numbers and lowercase letters>" in the list. I want to get the list to know that it's supposed to show an image, not only text (and display the image not just "get the list to know").
private DefaultListModel usersListModel = new DefaultListModel(); private JList usersJList = new JList(usersListModel); private JScrollPane usersScrollPane = new JScrollPane(usersJList);
usersListModel.addElement("Test Text");usersListModel.addElement(new GreenfootImage(10, 10));

