title: button to filter JTable for checkbox is selected
body: <p>I have a JTable fairly similar to this one. </p>
  
  <p><a href="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting" rel="nofollow noreferrer">http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting</a></p>
  
  <p><img src="https://docs.oracle.com/javase/tutorial/figures/uiswing/components/TableSortDemo.png" alt="table"></p>
  
  <p>I have managed to set a normal filter on it (a search function) and it works well. I want to have a button that will immediately show only the rows where Vegetarian is checked.</p>
  
  <p>Ok so now thanks to the help given by @peeskillet and @HovercraftFullOfEels, this is the solution to my problem:</p>
  
  <pre><code>final TableRowSorter&lt;MovieReviewTableModel&gt; rowSorter = new TableRowSorter&lt;MovieReviewTableModel&gt;(tableModel);
  
  
  
  // custom RowFilter 
              RowFilter&lt;MovieReviewTableModel, Integer&gt; filter = new RowFilter&lt;MovieReviewTableModel, Integer&gt;()
              {
                  // include method returns true to show the row and false to not show it
                  @Override
                  public boolean include(RowFilter.Entry&lt;? extends MovieReviewTableModel, ? extends Integer&gt; entry)
                  {
                      int modelRow = entry.getIdentifier(); //row index
                      boolean checked = ((Boolean)entry.getModel().getValueAt(modelRow, 3)).booleanValue();
                      System.out.println(checked); // to test the values coming through
                      return checked;
                  }
  
              };
  
              table.setRowSorter(rowSorter);
  
              JButton onlyFeatured = new JButton("Only show Featured");
              threeButtonPanel.add(onlyFeatured);
  
              onlyFeatured.addActionListener(new ActionListener()
              {
                  public void actionPerformed(ActionEvent event)
                  {
                      rowSorter.setRowFilter(filter);
                  }
              });
  </code></pre>
  
  <p>It works! Thanks so much guys, I owe you drinks or something. :D</p>