title: JTable sorting not the good value in the cell
body: <p>I am using NetBeans to write a program. I create a JTable with the design and I add rows to the table without any problem.</p>
  
  <p>When I click on the tab to sort the table it works, with <code>setAutoCreateRowSorter(true)</code>. However when I try to get the value of the updated cell it is not the good one. Indeed, it is the value of the previous cell, when I fill my table.</p>
  
  <p>This is how I add row to my table:</p>
  
  <pre><code>DefaultTableModel model = (DefaultTableModel) table.getModel();
  model.setRowCount(0);
  for (int i = 0; i &lt; arrayPep.size(); i++) {
     model.addRow(new Object[]{arrayPep.get(i).getPeptide(), arrayPep.get(i).getStart(), arrayPep.get(i).getStop(), arrayPep.get(i).geteValue(), arrayPep.get(i).getName()});
  }
  </code></pre>
  
  <p>This is how I try to get the value of the cell:</p>
  
  <pre><code>DefaultTableModel model = (DefaultTableModel) table.getModel();
  table.getModel().getValueAt(rowSelected, 0);
  </code></pre>
  
  <p>How could I fix this ?</p>