title: Java Swing | extend AbstractTableModel and use it with JTable | several questions
body: <p>I followed Oracle's model for implementing an AbstractTableModel</p>
  
  <p><a href="http://download.oracle.com/javase/tutorial/uiswing/examples/components/TableDemoProject/src/components/TableDemo.java" rel="nofollow">http://download.oracle.com/javase/tutorial/uiswing/examples/components/TableDemoProject/src/components/TableDemo.java</a></p>
  
  <p>I did this because my table has to contain 3 columns, and the first has to be a JCheckBox.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public class FestplattenreinigerGraphicalUserInterfaceHomePagePanelTableModel extends AbstractTableModel {
  private String[] columnNames = {"Auswahl",
                                      "Dateiname",
                                      "Pfad"};
      private Object[][] data = {
      {new Boolean(true), "datei.tmp",
       "/home/user/tmp"}
      };
  
      public int getColumnCount() {
          return columnNames.length;
      }
  
      public int getRowCount() {
          return data.length;
      }
  
      public String getColumnName(int col) {
          return columnNames[col];
      }
  
      public Object getValueAt(int row, int col) {
          return data[row][col];
      }
  
      public Class getColumnClass(int c) {
          return getValueAt(0, c).getClass();
      }
  
       public boolean isCellEditable(int row, int col) {
          if (col == 0) {
              return true;
          } else {
              return false;
          }
      }
  
       public void setValueAt(Object value, int row, int col) {            
          data[row][col] = value;
          fireTableCellUpdated(row, col);
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Here are my questions:</p>
  
  <ol>
  <li>How does JTable (<code>new JTable(FestplattenreinigerGraphicalUserInterfaceHomePagePanelTableModel)</code>) know what the column names are and their values are? Since there's no contructor in my AbstractTableModel?! Is it becaue columnNames and data must be named like they are and JTable accesses them? </li>
  <li>How can i put new Values in my JTable? Since columnNames and data are arrays. Can i replace them with vectors? If so, how do I init these vectors? In a constructor in myAbsTableModel?</li>
  </ol>
  
  <p>I think it's very easy to get a solution but this Table handling isn't trivial to me, so thank u very much!</p>