title: Table Renderer not working correctly in Java
body: <p>I read a lot of articles and finally got my JTable rendering as per my requirements but the problem is when the table is scrolled by user, some of the other hidden parts of jtable are also colored as shown in image below</p>
  
  <p><img src="https://i.stack.imgur.com/2AR7N.jpg" alt="enter image description here"></p>
  
  <p>And when the user scrolls the table, other parts are also got colored like this</p>
  
  <p><img src="https://i.stack.imgur.com/HT0BH.jpg" alt="enter image description here"></p>
  
  <p>Why this happens? I read many articles and and all of them show exactly the same thing but this...</p>
  
  <p>Here is my code</p>
  
  <pre><code>JTable table = new JTable()
  {
      public boolean isCellEditable(int rowIndex, int colIndex) 
      {
          return false;
      }
  };
  
  (DefaultTableCellRenderer)table.getTableHeader().getDefaultRenderer())
  .setHorizontalAlignment(JLabel.CENTER);
  table.setModel(new DefaultTableModel(new Object [][] {}, Columns));
  table.setRowHeight(25);
  table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 
  table.getColumnModel().removeColumn(table.getColumnModel().getColumn(0));
  table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer()
  {
      @Override
      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      {
          super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
          if(!table.getModel().getValueAt(row, 10).toString().equals("true"))
          {
              setBackground(new Color(246,137,137));
          }
          return this;
      }
   });
  
   JScrollPane areaScrollPane = new JScrollPane(table);
   areaScrollPane.setPreferredSize(new Dimension(width, height));
   MyPanel.add(areaScrollPane);
  </code></pre>
  
  <p>All the articles show this way to render custom row on condition base. What's wrong in my code? Thanks for any support.</p>