Can you add an image to the left of a JList item?

Jay Detwiler

Yes, you have control over how a JList item display through the ListCellRenderer. A renderer is used by the JList to return a component used to paint each item in the list. Typically, this is a JLabel that is reused for each item by simply changing its properties. In the case of the DefaultListCellRenderer, this only sets the text of the label (unless the item happens to be an icon). So, if you want to control the appearance of items in a JList implement a ListCellRenderer and set it on the JList.