title: How to filter JTable with respect to a specific column?
body: <p>I have <code>JFrame</code> with a <code>JTable</code> and <code>JComboBox</code> with choices</p>
  
  <ul>
  <li>"Leave Code" </li>
  <li>"Leave Description" </li>
  </ul>
  
  <p>I need to filter the table data with respect to leave code when leave code is selected in the combo box and filter with respect to leavedesc when leave description is selected in the combo box.</p>
  
  <p>This is the function that I've used to filter the data:</p>
  
  <pre><code>private void filtervalue(String filterString) {
      TableModel model = tableLeave.getModel();
      final TableRowSorter&lt;TableModel&gt; sorter = new TableRowSorter&lt;TableModel&gt;(model);
      tableLeave.setRowSorter(sorter);
      if (filterString.length() == 0) {
          sorter.setRowFilter(null);
      } else {
          sorter.setRowFilter(RowFilter.regexFilter("(?i)" + filterString));
      }
  }
  </code></pre>
  
  <p>But the problem is it will sort by leavedesc as well as leavecode, so no effect by the combo box. Please help me to implement column based filter.</p>