It sounds like your tree isn't detecting the nodesWereRemoved
event that should be triggered by the removeNodeFromParent(node);
method.
Are you using the standard DefaultTreeModel
and JTree
objects? If so, they should automatically refresh when doing a removal. If you've written a custom of either class, you're probably not handling the nodesWereRemoved
event (in your custom JTree
), or you're not triggering the event (in your custom DefaultTreeModel
).
If you're using the standard objects, try calling JTree.revalidate();
and JTree.repaint();
after you remove the node, to force the tree to be repainted from your model change.
A final suggestion, have you tried any of the removeXXX()
methods of JTree
instead?