title: How to add image in jlist
body: <p>Hi  i have created a j list and there i want to add an image before any text in that text  how can i do this i tried but i am not able to achieve my goal i want to add an image before list element"Barmer".</p>
  
  <pre><code>    public class ListDemo extends JPanel
                            implements ListSelectionListener {
          private JList list;
          private DefaultListModel listModel;
  
  
          public ListDemo() {
              super(new BorderLayout());
  
              listModel = new DefaultListModel();
              listModel.addElement("Barmer");
             //Create the list and put it in a scroll pane.
              list = new JList(listModel);
              list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              list.setSelectedIndex(0);
              list.addListSelectionListener(this);
              list.setVisibleRowCount(5);
              list.setBackground(new java.awt.Color(0,191,255));;
             list.setFont(new Font("Arial",Font.BOLD,35));
              list.setForeground( Color.white );
              list.setFixedCellHeight(60);
      list.setFixedCellWidth(50);
      list.setBorder(new EmptyBorder(10,20, 20, 20));
  
  
              JScrollPane listScrollPane = new JScrollPane(list);
              add(listScrollPane, BorderLayout.CENTER);
  
          }
           public void valueChanged(ListSelectionEvent e) {
  
          }
  
          private static void createAndShowGUI() {
              //Create and set up the window.
              JFrame frame = new JFrame("ListDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
              //Create and set up the content pane.
              JComponent newContentPane = new ListDemo();
              newContentPane.setOpaque(true); //content panes must be opaque
              frame.setContentPane(newContentPane);
             frame.setExtendedState(JFrame.MAXIMIZED_BOTH); 
      frame.setUndecorated(true);
  
              //Display the window.
              frame.pack();
              frame.setVisible(true);
          }
  
  
  
            public static void main(String[] args) {
  
                      createAndShowGUI();
  
          }
      }
  </code></pre>
  
  <p>How can i do this help me?</p>
  
  <p>Thanks in advance</p>