code: public static void setViewPortListeners(JTable table) {
          table.addPropertyChangeListener("ancestor", createAncestorPropertyChangeListener(table));
          // Install a listener to cause the whole table to repaint when a column
          // is resized. We do this because the extended grid lines may need to be
          // repainted. This could be cleaned up, but for now, it works fine.
          for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
              table.getColumnModel().getColumn(i).addPropertyChangeListener(createAncestorPropertyChangeListener(table));
              table.getColumnModel().addColumnModelListener(createTableColumnModelListener(table));
          }
      }
docs: Adds striping to the background of the given {@link JTable}. The actual
  striping is installed on the containing {@link JScrollPane}'s
  {@link JViewport}, so if this table is not added to a {@code JScrollPane}
  , then no stripes will be painted. This method can be called before the
  given table is added to a scroll pane, though, as a
  {@link PropertyChangeListener} will be installed to handle "ancestor"
  changes.
  
  @param table the table to paint row stripes for.