Java Code Examples for javax.swing.RowFilter#regexFilter()
The following examples show how to use
javax.swing.RowFilter#regexFilter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SBOLInputDialog.java From iBioSim with Apache License 2.0 | 6 votes |
private void updateFilter(String filterText) { filterText = "(?i)" + filterText; @SuppressWarnings({ "rawtypes", "unchecked" }) TableRowSorter<TopLevelTableModel> sorter = (TableRowSorter) table.getRowSorter(); if (filterText.length() == 0) { sorter.setRowFilter(null); } else { try { RowFilter<TopLevelTableModel, Object> rf = RowFilter.regexFilter(filterText, 0, 1); sorter.setRowFilter(rf); } catch (java.util.regex.PatternSyntaxException e) { sorter.setRowFilter(null); } } tableLabel.setText("Matching parts (" + sorter.getViewRowCount() + ")"); }
Example 2
Source File: DisksWindow.java From DiskBrowser with GNU General Public License v3.0 | 5 votes |
@Override public void actionPerformed (ActionEvent e) { RowFilter<DiskTableModel, Object> rf = null; try { rf = RowFilter.regexFilter (getFilterText (), 2); } catch (java.util.regex.PatternSyntaxException exception) { return; } sorter.setRowFilter (rf); }
Example 3
Source File: PhonebookUI.java From Spark with Apache License 2.0 | 5 votes |
private void filterTable(String text) { String filterString = text; ArrayList<RowFilter<TableModel, Object>> andFilter = new ArrayList<RowFilter<TableModel, Object>>(1); //split.length); ArrayList<RowFilter<TableModel, Object>> subFilter; RowFilter<TableModel, Object> rf; RowFilter<TableModel, Object> rf0; try { subFilter = new ArrayList<RowFilter<TableModel, Object>>(1); //split.length); for (Integer i = 0; i < model.getColumnCount(); i++) { rf0 = RowFilter.regexFilter("^(?i)" + filterString, i); subFilter.add(rf0); } rf = RowFilter.orFilter(subFilter); andFilter.add(rf); } catch (PatternSyntaxException pse) { Log.error(pse); } RowFilter<TableModel, Object> rowf = RowFilter.andFilter(andFilter); sorter.setRowFilter(rowf); }