title: How to update the rows of a DefaultTableModel in a JTable?
body: <p>Ok I have this table added to a JPanel added to a JFrame.</p>
  
  <p>In the mousePressed Event there it instates a new class tData and calls a method which returns data from the database as a string contained in a vector element.</p>
  
  <p>What I want to happen, every time the btn is pressed it updates the table,</p>
  
  <p>What does happen, every time the btn is pressed it updates the table but adds the same data to the end of the table?</p>
  
  <p>What would cause this to happen?</p>
  
  <pre><code>    Object columnHeaders[] = {"Fname", "Mname", "Lname", "Age"};
      Object data[][] = {{}};
      final DefaultTableModel dtm = new DefaultTableModel(data, columnHeaders);
  
      JTable tb = new JTable(dtm);
      JScrollPane scrollPane = new JScrollPane(tb);
  
      tableWrap.add(scrollPane);
  
      btn.addMouseListener(new MouseAdapter() {
  
          @Override 
          public void mousePressed(MouseEvent arg0) {
              tData h = new tData(10));
              Vector&lt;String&gt; v = h.getInfo();
              for(int i = 0; i &lt; v.size() ; i++) {
                  dtm.insertRow(i, new Object[]{v.get(i).split(",")[0], v.get(i).split(",")[1], v.get(i).split(",")[2], v.get(i).split(",")[3]});
              }
  
              dtm.fireTableDataChanged();
              frame.repaint();
          }
      });
  </code></pre>