void () { TreeSpeedSearch supply = new TreeSpeedSearch(myTree, true, null, p -> StringUtil.notNullize(getText(p == null ? null : getUserObject((TreeNode)p.getLastPathComponent())))) { @Override protected void onSearchFieldUpdated(String pattern) { super.onSearchFieldUpdated(pattern); //constructor of popup if (StringUtil.isNotEmpty(pattern) && !isPopupActive()) { SwingUtilities.invokeLater(() -> { getSearchModel().refilter(); if (StringUtil.isNotEmpty(pattern)) TreeUtil.expandAll(myTree); }); } else { getSearchModel().refilter(); } } }; supply.setupListeners(); getSearchModel().setSpeedSearch(supply); }