How to use Swingx Components: jXSearchPanel with jTable
Question
I would like to have some exemple of implementation of jXSearchPanel with jTable. I didn't find something on the web.
Thank you in advance,
Best Regards,
Florent
Solution
I have successful implement the jxsearchpanel with jtable. This is my code:
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
jTable1.setRowSorter(sorter);
Pattern pattern = jXSearchPanel1.getPattern();
sorter.setRowFilter(RowFilters.regexFilter(pattern, 0));
OTHER TIPS
How about the official one?
You can download source from this java net project.
JXSearchPanel pnlSearch = new JXSearchPanel();
pnlSearch.setBounds(10, 6, 503, 45);
pnlSearch.addPatternMatcher(new PatternMatcher() {
@Override
public void setPattern(Pattern p) {
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
tblUser.setRowSorter(sorter);
Pattern pattern = p;
sorter.setRowFilter(RowFilters.regexFilter(pattern, 0));
}
@Override
public Pattern getPattern() {
return null;
}
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow