Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top