Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JTable with ability to filter using swingx-1.6

I'm trying myself developing a desktop application with Java and Java Swing. Currently I'm implementing a property table where can I handle different types of properties of an object. For that I created a custom table model.

However I got some problems adding a filter ability which shows only properties matching a given string.

I found a neat library called swingx which provides many functions I need, like filtering.

This tutorial (http://www.javalobby.org/java/forums/t18819.html) shows examples of how to implement it in JXTable but it won't work. Seems that swingx-1.6 kicked out the setFilter-method().

Any ideas?

Filter[] filterArray = { new PatternFilter("(.*1st.*)|(.*Final.*)", 0, 0) };
        FilterPipeline filters = new FilterPipeline(filterArray);
        table.setFilters(filters);
like image 264
uriel Avatar asked Jan 21 '26 11:01

uriel


1 Answers

JTable supports filtering. See the section from the Swing tutorial on Sorting and Filtering for a working example.

like image 86
camickr Avatar answered Jan 22 '26 23:01

camickr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!