سؤال

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?

هل كانت مفيدة؟

المحلول

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().

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top