0

When deleting one node with a child (tree), I don't know how to set the child of a node as the child of the parent of the node and then remove the node in the JTree.

Just like:

node.getChildNode().setParent(node.getParent)
node = null

When I tried to use:

node.removeFromParent()

It will remove this node including its subtrees directly. What's more, I want to know how to expand a path that is from the root to a specific node. I tried some methods online, however, after calling the method like jtree.updateUI() and model.reload(), UI didn't change.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • [Adding and removing nodes from a JTree](https://stackoverflow.com/questions/7928839/adding-and-removing-nodes-from-a-jtree) – Abra Dec 01 '21 at 04:41
  • [How to Use Trees](https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html) – Abra Dec 01 '21 at 04:44

0 Answers0