title: Background color to selected item in JList not working
body: <p>Why my selected item background not changing? I surely know that i press list item because my System.out.println says my Current selection and showing id of selected item. No errors no nothing just not working. Why ?   </p>
  
  <pre><code> Object[] tablen = sqltable.toArray();
   JList list;
   list = new JList(tablen);                     
   list.addListSelectionListener(new ListSelectionListener(){
    @Override
    public void valueChanged(ListSelectionEvent e) {
     int idx = list.getSelectedIndex();
     setOpaque(true);
      if (idx != -1){
      //list.setSelectionBackground(Color.lightGray);
      // list.setSelectionForeground(Color.lightGray);
      setForeground(Color.red);
      setBackground(Color.BLUE);
      setBackground(list.getSelectionBackground());
      setForeground(list.getSelectionForeground()); 
      System.out.println("Current selection: " + tablen[idx]);
     }else{
       setForeground(Color.red);
       setBackground(Color.BLUE);
       setBackground(list.getBackground());
       setForeground(list.getForeground());
       System.out.println("Please choose a language."); 
          }
    }                     
  });
     list.setCellRenderer(new ListCellRenderer() {
     @Override
     public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
       String[] val = (String[]) value;
       return new JLabel(val[0]);
      }                           
  });
  </code></pre>