if (treeNode != null && treeNode.getParent() != null)
{ TreePath parentPath = treeMain.getSelectionPath().getParentPath();KDTreeNode parentNode = (KDTreeNode) treeNode.getParent();
parentNode.remove(treeNode);
treeMain.updateUI();
treeMain.setSelectionPath(parentPath);
treeBuilder.refreshTreeNode(treeMain , parentNode ,this.getDefaultFilterForTree());
treeMain.expandPath(parentPath);
}