title: JTable with 100+ rows lag up the application
body: <p>I have a JTable in my application that has 100+ rows that are added dynamically one by one.</p>
  
  <p>It stores data about clients that have ordered something and the more orders during the day the more rows there are.
  When we have a busy day with 100+ orders the JTable becomes extremely slow when scrolling.</p>
  
  <p>I use a custom renderer to change the background color of a few cells and thats about it. I have tried using TableModelEvent to only alter the color of the rows that are visible.</p>
  
  <p>Doing so has increased the speed a bit but still not enough to scroll smoothly.
  What are the options I have to try optimize my JTable that has/will have a lot of data?</p>
  
  <p>EDIT: I can provide my Jtable and my CustomCellRenderer If needed.</p>
  
  <pre><code>private static class CustomRenderer extends DefaultTableCellRenderer {
  
          private static final long serialVersionUID = -5699527287605065L;
  
          public CustomRenderer() {
              setHorizontalAlignment(SwingConstants.CENTER);
          }
  
          @Override
          public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
                  int row, int column) {
              Component cellComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
                      column);
              vis.set(row, column);
              if (vis.isVisible(table)) {
                  Object o = table.getValueAt(row, column);
  
                  if (column != 1 &amp;&amp; column != 5 &amp;&amp; column != 10 &amp;&amp; !isSelected) {
                      cellComponent.setBackground(Color.WHITE);
                      if ((row % 2) == 0) cellComponent.setBackground(Colors.gray);
                  }
  
                  if (o != null) {
                      if (o.toString().contains("Liqui") &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.green);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (o.toString().contains("Green Alert") &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.yellow);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (o.toString().contains("Red Alert") &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.red);
                          cellComponent.setForeground(Color.WHITE);
                      } else if (column == 10 &amp;&amp; o.toString().contains("Finalizado")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.green);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (column == 10 &amp;&amp; o.toString().contains("Cancelado")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.red);
                          cellComponent.setForeground(Color.WHITE);
                      } else if (column == 10
                              &amp;&amp; o.toString().contains("Comprovante em analise")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.yellow);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (column == 10 &amp;&amp; o.toString().contains("Aguardando retirada")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.ltOrange);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (column == 10 &amp;&amp; o.toString().contains("Entrega agendada")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.orange);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (column == 1
                              &amp;&amp; o.toString().toLowerCase().contains("test1")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.test1);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (column == 1 &amp;&amp; o.toString().contains("test2")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.test2);
                          cellComponent.setForeground(Color.WHITE);
                      } else if (column == 1 &amp;&amp; o.toString().contains("test3")
                              &amp;&amp; !isSelected) {
                          cellComponent.setBackground(Colors.test3);
                          cellComponent.setForeground(Color.WHITE);
                      } else if (!isSelected &amp;&amp; (row % 2) == 0) {
                          cellComponent.setBackground(Colors.gray);
                          cellComponent.setForeground(Color.BLACK);
                      } else if (!isSelected) {
                          cellComponent.setBackground(Color.WHITE);
                          cellComponent.setForeground(Color.BLACK);
                      }
  
                      if (Lists.op_list != null) {
                          for (int i = 0; i &lt; Lists.op_list.size(); i++) {
                              if (column == 8 &amp;&amp; !isSelected) {
                                  if (table.getValueAt(row, 8) != null &amp;&amp; table.getValueAt(row, 7) != null) {
                                      if (Lists.op_list.get(i).getFornIDSent() == 1
                                              &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i)
                                                      .getOperationID()) {
                                          cellComponent.setBackground(Colors.green);
                                      } else if (Lists.op_list.get(i).getFornIDSent() == 2
                                              &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i)
                                                      .getOperationID()) {
                                          cellComponent.setBackground(Colors.yellow);
                                      } else if ((int) table.getValueAt(row, 7) == Lists.op_list.get(i)
                                              .getOperationID()) {
                                          cellComponent.setBackground(Color.WHITE);
                                          if ((row % 2) == 0) cellComponent.setBackground(Colors.gray);
                                      }
                                  }
                              }
  
                              if (table.getValueAt(row, 10).toString().contains("Comprovante em analise") &amp;&amp; column == 10
                                      &amp;&amp; !isSelected) {
                                  if (Lists.op_list.get(i).getSituation() == 1
                                          &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i).getOperationID()) {
                                      cellComponent.setBackground(Colors.green);
                                      cellComponent.setForeground(Color.BLACK);
                                  } else if (Lists.op_list.get(i).getComprovanteAllowed() == 1
                                          &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i).getOperationID()) {
                                      cellComponent.setBackground(Colors.green_dark);
                                      cellComponent.setForeground(Color.BLACK);
                                  } else if (Lists.op_list.get(i).getComprovanteAllowed() == 2
                                          &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i).getOperationID()) {
                                      cellComponent.setBackground(Colors.yellow_dark);
                                      cellComponent.setForeground(Color.WHITE);
                                  }
                              }
  
                              if (column == 9 &amp;&amp; !isSelected) {
                                  if (Lists.op_list.get(i).getPreBolSent() == 1
                                          &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i).getOperationID()) {
                                      cellComponent.setBackground(Colors.green);
                                  } else if (Lists.op_list.get(i).getPreBolSent() == 2
                                          &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i).getOperationID()) {
                                      cellComponent.setBackground(Colors.yellow);
                                  } else if (Lists.op_list.get(i).getPreBolSent() == 0
                                          &amp;&amp; (int) table.getValueAt(row, 7) == Lists.op_list.get(i).getOperationID()) {
                                      cellComponent.setBackground(Color.WHITE);
                                      if ((row % 2) == 0) cellComponent.setBackground(Colors.gray);
                                  }
                              }
                          }
                      }
                  }
  
              } else {
                  cellComponent.setBackground(Color.WHITE);
                  cellComponent.setForeground(Color.BLACK);
              }
  
              vis.reset();
              return cellComponent;
          }
      }
  </code></pre>