public void newFilter() {
RowFilter<ListTable, Object> rf = null;
//If current expression doesn't parse, don't update.
try {
rf = RowFilter.regexFilter(filterText.getText(), 0);
} catch (java.util.regex.PatternSyntaxException e) {
return;
}
sorter.setRowFilter(rf);
}
我在http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting使用此过滤器 但是这个过滤器似乎只能在我的表上过滤int组件(除了第一个col,所有其他都是字符串)。我只想创建一个过滤器,使任何行都保留输入的文本。我对这门语言比较陌生,非常感谢你的帮助!