void () { String text = myFilterPanel.isVisible() ? myFilterField.getText() : ""; Object selection = myThreadList.getSelectedValue(); DefaultListModel<ThreadState> model = (DefaultListModel<ThreadState>)myThreadList.getModel(); model.clear(); int selectedIndex = 0; int index = 0; List<ThreadState> threadStates = UISettings.getInstance().getState().getMergeEqualStackTraces() ? myMergedThreadDump : myThreadDump; for (ThreadState state : threadStates) { if (StringUtil.containsIgnoreCase(state.getStackTrace(), text) || StringUtil.containsIgnoreCase(state.getName(), text)) { model.addElement(state); if (selection == state) { selectedIndex = index; } index++; } } if (!model.isEmpty()) { myThreadList.setSelectedIndex(selectedIndex); } myThreadList.revalidate(); myThreadList.repaint(); }