Capture Tree View State

Is there a tree view property I can capture that holds the state of which nodes are expanded? I have a tab and tree navigation setup i am working on and when I switch between tabs the tree item data changes. when i switch back to an already visited tab the tree goes back to the original state. I was hoping i could hold the state in a property and assign it back to the tree when returning to a tab.

Thank you,

Not really. “Remembering” tree expansion state is a bit hairy. You’d have to get the underlying JTree, ask it for the tree paths that are expanded, store them, and then when appropriate, try and expand those paths again. Check out the JavaDocs for JTree: … JTree.html

It is not clear to me how to get the JTree out of the PMITreeView. I use the dir(tree.class) to see what methods were available, but i do not see any that sound like they would give me the JTree.

Thanks for the help,

You can get the JTree by getting the component instance however you like, and then calling getViewport().getView() on it: