title: Error in getRowCount() on DefaultTableModel
body: <p><strong>EDIT</strong></p>
  
  <p>I've tried changing the table model back to DefaultTableModel but I am getting an Exception when compiling my code and I can't figure out why!</p>
  
  <p>Here's my table init:</p>
  
  <pre><code>jTable1.setModel(new Table1Model());
  jTable1.setDefaultRenderer(Color.class,new ColorRenderer(true));
  jTable1.getColumnModel().getColumn(5).setCellEditor(new ColorEditor());
  </code></pre>
  
  <p>My class extending the model:</p>
  
  <pre><code>class Table1Model extends DefaultTableModel {
      //private String[] columnNames = {"Station #",
      private Object[] columnNames = {"Station #",
                                      "Name",
                                      "avg Time",
                                      "Buffer",
                                      "Buffer Parts",
                                      "Color"};
      private Object[][] data = {
      {"1", "Station 1",
       new Integer(10), false, new Integer(0), Color.red},
      {"2", "Station 2",
       new Integer(10), false, new Integer(0), Color.blue},
      {"3", "Station 3",
       new Integer(10), false, new Integer(0), Color.green},
      {"4", "Station 4",
       new Integer(10), false, new Integer(0), Color.orange},
      {"5", "Station 5",
       new Integer(10), false, new Integer(0), Color.black}
      };
  
  
      @Override
      public int getColumnCount() {
          return columnNames.length;
      }
  
     @Override
      public int getRowCount() {
         //int length = data.length;
         //int datalength = Integer.parseInt(length);
         return data.length;
      }
  
      @Override
      public String getColumnName(int col) {
          return columnNames[col].toString();
      }
  
      @Override
      public Object getValueAt(int row, int col) {
          return data[row][col];
      }
  
      /*
       * JTable uses this method to determine the default renderer/
       * editor for each cell.  If we didn't implement this method,
       * then the last column would contain text ("true"/"false"),
       * rather than a check box.
       */
      @Override
      public Class getColumnClass(int c) {
          return getValueAt(0, c).getClass();
      }
  
      /*
       * Don't need to implement this method unless your table's
       * editable.
       */
      @Override
      public boolean isCellEditable(int row, int col) {
          //Note that the data/cell address is constant,
          //no matter where the cell appears onscreen.
          if (col == 0) { return false; }
          else if (col == 4) { 
              boolean di = (Boolean) getValueAt(row,(col-1));
              if (!di) { return false; }
              else { return true; }
          }
          else { return true; }
      }
  
      /*
       * Don't need to implement this method unless your table's
       * data can change.
       */
      @Override
      public void setValueAt(Object value, int row, int col) {
          data[row][col] = value;
          fireTableCellUpdated(row, col);
      }
  
     /*public void removeRow(int row) {
          data.removeRow(row);
      }*/
  
  
      private void printDebugData() {
          int numRows = getRowCount();
          int numCols = getColumnCount();
  
          for (int i=0; i &lt; numRows; i++) {
              System.out.print("    row " + i + ":");
              for (int j=0; j &lt; numCols; j++) {
                  System.out.print("  " + data[i][j]);
              }
              System.out.println();
          }
          System.out.println("--------------------------");
      }
  }
  </code></pre>
  
  <p>This generates the following error:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
  at SimGui$Table1Model.getRowCount(SimGui.java:863)
  at javax.swing.table.DefaultTableModel.setDataVector(DefaultTableModel.java:224)
  at javax.swing.table.DefaultTableModel.&lt;init&gt;(DefaultTableModel.java:124)
  at javax.swing.table.DefaultTableModel.&lt;init&gt;(DefaultTableModel.java:106)
  at javax.swing.table.DefaultTableModel.&lt;init&gt;(DefaultTableModel.java:86)
  at SimGui$Table1Model.&lt;init&gt;(SimGui.java:832)
  at SimGui.initComponents(SimGui.java:265)
  at SimGui.&lt;init&gt;(SimGui.java:34)
  at SimGui$16.run(SimGui.java:789)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701)
  at java.awt.EventQueue.access$000(EventQueue.java:102)
  at java.awt.EventQueue$3.run(EventQueue.java:662)
  at java.awt.EventQueue$3.run(EventQueue.java:660)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:671)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
  </code></pre>
  
  <p>Can you help me figure out what's wrong? 
  Also, will I be able to use the ColorEditor with the DefaultTableModel?</p>