Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JTree expandPath question...

Status
Not open for further replies.

MartinF

Technical User
Sep 19, 2000
143
0
0
FR
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top