void (TreeModelEvent treeModelEvent) { TreePath pathToDelete = treeModelEvent.getTreePath(); Object[] children = treeModelEvent.getChildren(); for (Object nodeToDelete : children) { if (myCurrentSelection.contains(nodeToDelete)) { int deletedRow = myTree.getRowForPath(pathToDelete.pathByAddingChild(nodeToDelete)); if (deletedRow == 0) return; TreePath treePath = new TreePath(myTree.getPathForRow(deletedRow - 1)); myTree.getSelectionModel().addSelectionPath((TreePath)treePath.getLastPathComponent()); } } }