title: Java JTable update row
body: <p>I am creating a JTable like this:</p>
  
  <pre class="lang-java prettyprint-override"><code>           String[] colName = new String[] {
                 "ID#", "Country", "Name", "Page titel", "Page URL", "Time"
             };
             Object[][] products = new Object[][] {
                 {
                     "123", "USA", "Bill", "Start", "http://www.url.com", "00:04:23"
                 },
  
                 {
                     "55", "USA", "Bill", "Start", "http://www.url.com", "00:04:23"
                 }
  
             };
  
             dtm = new DefaultTableModel(products, colName);
             table = new JTable(dtm);
  </code></pre>
  
  <p>How could i update the row by ID? i want to update the whole row where the ID equals 55.</p>
  
  <p>Edit: I know how to detele by row ID but how do i actually update the cells?</p>
  
  <pre class="lang-java prettyprint-override"><code>  public void removeVisitorFromTable(String visitorID) {
      int row = -1; //index of row or -1 if not found
  
      //search for the row based on the ID in the first column
      for(int i=0;i&lt;dtm.getRowCount();++i)
          if(dtm.getValueAt(i, 0).equals(visitorID)) {
              row = i;
              break;
          }
  
      if(row != -1) {
          dtm.removeRow(row);//remove row
      } else {
  
      }
  }
  </code></pre>