user691305
user691305

Reputation: 1600

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. 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?

Upvotes: 2

Views: 1220

Answers (2)

user691305
user691305

Reputation: 1600

Got it thanks, sorter.setRowFilter(RowFilter.notFilter(RowFilter.regexFilter(expr)));

Upvotes: 1

Joseph Kendall
Joseph Kendall

Reputation: 226

RowFilter has a static method called notFilter(), which takes a RowFilter as an argument and returns a new RowFilter that has the opposite effect. You could take your regexFilter and pass it to RowFilter.notFilter().

Upvotes: 5

Related Questions