I would like to filter some rows in a JTable but all the stuff google found me is for java 1.6. I would like to do this using java 1.5 since i can not upgrade?
+1
A:
You should be able to use the SwingX library to accomplish this:
e.g.
Filter[] filterArray = { new PatternFilter("(.*1st.*)|(.*Final.*)", 0, 0) };
FilterPipeline filters = new FilterPipeline(filterArray);
table.setFilters(filters);
There's an article here on this:
http://www.javalobby.org/java/forums/t18819.html
You can chain various filters together using the FilterPipeline and there's a bunch of built in filters that can be used (ShufflerSorter, PatternFilter).
It should provide you with what you need without resorting to a Java 6 upgrade.
Jon
2009-08-18 05:33:59
Word of warning - The performance over large datasets is pretty poor in comparison to JDK 6's JTable filtering.
Adamski
2009-08-18 07:49:35
A:
I haven't used them (I'm lucky enough to be using 1.6) but you could try Glazed Lists. It seems to work with 1.5.
KitsuneYMG
2009-08-18 09:59:19