[英]Java 1.5 Filter JTable
I would like to filter some rows in a JTable but all the stuff google found me is for java 1.6. 我想过滤JTable中的某些行,但是Google发现我的所有东西都是针对Java 1.6的。 I would like to do this using java 1.5 since i can not upgrade? 我想使用Java 1.5进行此操作,因为我无法升级?
You should be able to use the SwingX library to accomplish this: 您应该能够使用SwingX库来完成此任务:
eg 例如
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 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). 您可以使用FilterPipeline将各种过滤器链接在一起,并且可以使用大量内置过滤器(ShufflerSorter,PatternFilter)。
It should provide you with what you need without resorting to a Java 6 upgrade. 它应该为您提供所需的内容,而无需借助Java 6升级。
I haven't used them (I'm lucky enough to be using 1.6) but you could try Glazed Lists . 我还没有使用过它们(我很幸运能够使用1.6),但是您可以尝试Glazed Lists 。 It seems to work with 1.5. 似乎可以在1.5下使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.