title: change background color of row in jtable after selection
body: <p>I am trying to create a <code>TableCellRenderer</code> which changes the background of row. I am overriding the <code>prepareRenderer</code>, it changes the background of row on selection but as soon as I change the selection the default background color(white) is set to previous selected row and newer row gets the background color(light grey).</p>
  
  <p>Here is my code:</p>
  
  <blockquote>
  <pre><code>final JTable table = new JTable(model)
      {
              @Override
          public Component prepareRenderer(TableCellRenderer renderer,int row,int column)
          {
              Component comp=super.prepareRenderer(renderer,row, column);
             int modelRow=convertRowIndexToModel(row);
             if(!isRowSelected(modelRow))
                 comp.setBackground(Color.WHITE);
             else
                 comp.setBackground(Color.LIGHT_GRAY);
             return comp;
          }
      };
  </code></pre>
  </blockquote>
  
  <p>My output screen:</p>
  
  <p><img src="https://i.stack.imgur.com/xy1eH.png" alt="enter image description here"></p>
  
  <p>I want to do like this:</p>
  
  <p><img src="https://i.stack.imgur.com/3QQ36.jpg" alt="enter image description here"></p>