[英]How to filter a row OUT of a JTable using RowFilter
Every example I have seen for this uses RowFilter.regexFilter and filters everything else out except the given text. 我看到的每个示例都使用RowFilter.regexFilter并过滤掉除给定文本之外的所有其他内容。 I want the rows of the given text filtered OUT. 我希望将给定文本的行过滤掉。 It doesn't even make sense the other way to me. 对我来说,这甚至没有任何意义。 A coffee filter filters the Coffee grounds OUT, not the other way around. 咖啡过滤器会将咖啡渣过滤掉,而不是反过来。
How do you filter OUT the rows containing the supplied text out of a JTable? 如何从JTable中过滤出包含提供的文本的行?
RowFilter
has a static method called notFilter()
, which takes a RowFilter
as an argument and returns a new RowFilter
that has the opposite effect. RowFilter
有一个名为notFilter()
的静态方法,该方法将RowFilter
作为参数,并返回具有相反作用的新RowFilter
。 You could take your regexFilter
and pass it to RowFilter.notFilter()
. 您可以使用regexFilter
并将其传递给RowFilter.notFilter()
。
谢谢了, sorter.setRowFilter(RowFilter.notFilter(RowFilter.regexFilter(expr)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.