JXList extends JList { @SuppressWarnings("unchecked") public <R extends ListModel> void setRowFilter(RowFilter<? super R, ? super Integer> filter) { if (hasSortController()) { SortController<R> controller = (SortController<R>) getSortController(); controller.setRowFilter(filter); } } JXList();  JXList(ListModel dataModel);  JXList(Object[] listData);  JXList(Vector<?> listData);  JXList(boolean autoCreateRowSorter);  JXList(ListModel dataModel, boolean autoCreateRowSorter);  JXList(Object[] listData, boolean autoCreateRowSorter);  JXList(Vector<?> listData, boolean autoCreateRowSorter); Searchable getSearchable(); void setSearchable(Searchable searchable); @Override int getNextMatch(String prefix, int startIndex, Bias bias); void setRolloverEnabled(boolean rolloverEnabled); boolean isRolloverEnabled(); @Override Point getPopupLocation(MouseEvent event); Point getPopupTriggerLocation(); boolean getAutoCreateRowSorter(); void setAutoCreateRowSorter(boolean autoCreateRowSorter); RowSorter<? extends ListModel> getRowSorter(); void setRowSorter(RowSorter<? extends ListModel> sorter); void setSortable(boolean sortable); boolean isSortable(); void setSortsOnUpdates(boolean sortsOnUpdates); boolean getSortsOnUpdates(); void setSortOrderCycle(SortOrder... cycle); SortOrder[] getSortOrderCycle(); Comparator<?> getComparator(); void setComparator(Comparator<?> comparator); @SuppressWarnings("unchecked") void setRowFilter(RowFilter<? super R, ? super Integer> filter); @SuppressWarnings("unchecked") RowFilter<?, ?> getRowFilter(); void resetSortOrder(); void toggleSortOrder(); void setSortOrder(SortOrder sortOrder); SortOrder getSortOrder(); Object getElementAt(int viewIndex); @Override Object getSelectedValue(); @Override void setSelectedValue(Object anObject,boolean shouldScroll); @Override Object[] getSelectedValues(); int getElementCount(); int convertIndexToModel(int viewIndex); int convertIndexToView(int modelIndex); @Override void setModel(ListModel model); void setHighlighters(Highlighter... highlighters); Highlighter[] getHighlighters(); void addHighlighter(Highlighter highlighter); void removeHighlighter(Highlighter highlighter); String getStringAt(int row); @Override ListCellRenderer getCellRenderer(); ListCellRenderer getWrappedCellRenderer(); @Override void setCellRenderer(ListCellRenderer renderer); void invalidateCellSizeCache(); @Override void updateUI(); @Override String getUIClassID(); final static String uiClassID; static final String EXECUTE_BUTTON_ACTIONCOMMAND; }
@Test public void testRevalidateOnSetRowFilter() throws InterruptedException, InvocationTargetException { if (GraphicsEnvironment.isHeadless()) { LOG.fine("cannot run ui test - headless environment"); return; } final JXList list = new JXList(AncientSwingTeam.createNamedColorListModel(), true); showWithScrollingInFrame(list, ""); final Dimension size = list.getSize(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { RowFilter<? super ListModel, ? super Integer> filter = RowFilters.regexFilter(Pattern.CASE_INSENSITIVE, "^b"); list.setRowFilter(filter); } }); SwingUtilities.invokeAndWait(new Runnable() { public void run() { assertTrue("height must be adjusted to reduced number of rows, " + "but was (old/current): " + size.height + "/" + list.getSize().height, size.height - 50 > list.getSize().height); } }); }