Reputation: 15341
I want to have a GUI application which would contain multiple tabs, each with its own Table. I would like to include a search box below the tabs which would filter the currently selected tab. How can this dynamic behaviour be achieved?
Upvotes: 1
Views: 281
Reputation: 109815
figure one you can to share RowSorter/RowFilter
for all JTables
in current JVM instance
filtering works for all JTables
notice there could be performance issue in the case that there is/are JTable(s) contains bunch of rows
quite possible for JTables
that contains a few (limited number of) rows together
determine (from arrays of tabs) visible tab, visible JComponents(or have to look at SwingUtilities), then remove RowSorter/RowFilter
from all JTables
instances and then to add RowSorter/RowFilter
to the visible an focusable JTable
JTextField
for RowSorter/RowFilter
should be crated only once times
Upvotes: 3