JTree not expanding?
I have a small method that removes all branches and leaves from a tree and then adds them all again (because one has changed). At the end it should expand the treePath to the leaf that changed, but it doesn't.
The addToTree method adds all the branches and leaves back, and works fine, after all the code has finished my tree is all there, laid out properly, but it's all collapsed.
TreePath openNode = pathToLeaf().getParentPath();
DefaultTreeModel model = (DefaultTreeModel)myTree.getModel();
Object root = model.getRoot();
for (int i=0; i<model.getChildCount(root); i++)
MutableTreeNode child = (MutableTreeNode)model.getChild(root, i);
model.setRoot(addToTree(null, new File(installedDir + "/projects")));
Even more interestingly, the program returns myTree.isExpanded as true, but it isn't???
Am I missing something?
Any help would be appreciated,