Hello,
I have constructed a Jtree from DefaultMutableTreeNodes which have been created within a loop from a database recordset.
The final step in my process is to create the JTree from the root node. This works great, and all the child nodes work fine.
Now though i want to expand certain child nodes (there are 3 levels from the root). I was trying to create a vector of DefaultMutableTreeNodes.getPath()'s for the nodes i want to expand once the JTree had been created. However, this method returns an array of TreeNodes as the 'path', so how do i translate this array of TreeNodes into a TreePath that JTree.expandPath(...) will accept?
I tried creating my vector elemenst with (new TreePath(partNode.getPath()) but when i later use JTree.expandPath(...) with these TreePath objects in my Vector, nothing happens!!! not even an error!!
Do i need to repaint the JTree or anything?
Thanks in advance
Martin
I have constructed a Jtree from DefaultMutableTreeNodes which have been created within a loop from a database recordset.
The final step in my process is to create the JTree from the root node. This works great, and all the child nodes work fine.
Now though i want to expand certain child nodes (there are 3 levels from the root). I was trying to create a vector of DefaultMutableTreeNodes.getPath()'s for the nodes i want to expand once the JTree had been created. However, this method returns an array of TreeNodes as the 'path', so how do i translate this array of TreeNodes into a TreePath that JTree.expandPath(...) will accept?
I tried creating my vector elemenst with (new TreePath(partNode.getPath()) but when i later use JTree.expandPath(...) with these TreePath objects in my Vector, nothing happens!!! not even an error!!
Do i need to repaint the JTree or anything?
Thanks in advance
Martin