aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to get the TreePath of a newly inserted TreeNode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to get the TreePath of a newly inserted TreeNode" Watch "How to get the TreePath of a newly inserted TreeNode" New topic
Author

How to get the TreePath of a newly inserted TreeNode

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255


I insert a new node called newProblem into a parent node called selectedNode.
I have the TreePath to the parent node, but I want to know how to get the TreePath to that new node called newProblem.
Anyone know how?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4545
    
    5

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

luck, db
There are no new questions, but there may be new answers.
Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Hello Kevin,

Your code doesn't make sense I'm afraid... You're inserting null into the TreeModel. If your newProblem is a DefaultMutableTreeNode then getting the path is easy:



Olly
Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
Sorry about not including a whole runnable code.
Anyway, line 8 is what I wanted to know. Thank you!
 
wood burning stoves
 
subject: How to get the TreePath of a newly inserted TreeNode