How to filter a row OUT of a JTable using RowFilter
Pergunta
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?
Solução
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()
.
Outras dicas
Got it thanks, sorter.setRowFilter(RowFilter.notFilter(RowFilter.regexFilter(expr)));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow