uriel
uriel

Reputation: 177

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);

Upvotes: 3

Views: 2381

Answers (1)

camickr
camickr

Reputation: 324197

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

Upvotes: 4

Related Questions