JTree: show only subtree
Posted on 2007-08-03
I have an already populated JTree, such as:
and then i need a tree where the root is child1, which look like:
This means i just want to hide all other nodes. Also the nodes which are the parents of my new defined root node. (And of course i need to do this on any level)
And later on i need the whole tree again; this is why i don't want to just set a new tree-strucure to the model.
To make it more clear: i have a JTree and 2 Buttons called: "Show full tree" and "Show selected subtree".
Is there a good way to do this, or do i have to set a new model (with model data) to the tree?