title: JTable correct row number after filtering
body: <p>Here is a try block which serves the purpose of filtering through table_job to find rows which match keyword. However, when the table model changes, I am struggling to obtain the correct row index. It always picks the the first row, even though the filtered result shows a row which is not first.</p>
  
  <p>I understand you can do something with <code>fireTableDataChanged()</code>, but I am not sure HOW and WHERE to do this, in the <code>try</code> and <code>catch</code> block OR in the <code>setLabelText()</code> method which displays the content of the table as <code>. JLabel</code></p>
  
  <pre><code>try 
  {
      sql = "SELECT Job.jobID as 'Job ID', Employer.name as'Company', Job.title as 'Role', Job.description as  'Description', Job.type as 'Type', Job.benefits as 'Benefits', Job.closing as 'Closing Date' FROM Job INNER JOIN Employer ON Job.employerID=Employer.employerID ORDER BY Employer.name";
      pst = conn.prepareStatement(sql);
      rs = pst.executeQuery();
      TableModel model = DbUtils.resultSetToTableModel(rs);
      table_job.setModel(model);
      final TableRowSorter&lt;TableModel&gt; sorter = new TableRowSorter&lt;TableModel&gt;(model);
      table_job.setRowSorter(sorter);               
      searchJob.addActionListener(new ActionListener()
      {
  
          public void actionPerformed(ActionEvent e) 
          {
              String text = keyword.getText(); 
              if (text.length() == 0) 
              {
                  sorter.setRowFilter(null);
              } 
              else 
              {
                  sorter.setRowFilter(RowFilter.regexFilter(text));
              }
          }             
      });
  }
  catch (Exception e) 
  {
      e.printStackTrace();                
  }
  
  private void setLabelText() 
  {
      try 
      {
          String table_click0 = (table_job.getModel().getValueAt(
                  row, 0).toString());
          String sqlSt = "SELECT Employer.name, * FROM Job INNER JOIN Employer ON Job.employerID = Employer.employerID WHERE jobID='"+table_click0+"' ";
          //rest of code to Label text...
      }
  </code></pre>
  
  <p>The <code>String table_click0 = (table_job.getModel().getValueAt(row, 0).toString());</code> is picking up the wrong row, not the updated selected row. How can I take this into account? </p>