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.