Im trying to filter rows based on a column say c1 that contains boolean values. I want to show only rows that have 'true' in c1. I looked up the examples in http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting. The example uses a regex filter. Is there any way I can use boolean values to filter rows?
Following is the code Im using (borrowed from the example)
private void filter(boolean show) {
RowFilter<TableModel, Object> filter = null;
TableModel model = jTb.getModel();
boolean value = (Boolean) model.getValueAt(0,1);
//If current expression doesn't parse, don't update.
try {
// I need to used 'value' to filter instead of filterText.
filter =RowFilter.regexFilter(filterText, 0);
} catch (java.util.regex.PatternSyntaxException e) {
return;
}
sorter.setRowFilter(filter);
}
thank you.