aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes New node in JTree not visible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "New node in JTree not visible" Watch "New node in JTree not visible" New topic
Author

New node in JTree not visible

Lee Feder
Greenhorn

Joined: Aug 11, 2000
Posts: 20
I've spent ages on this problem but to no avail. Hopefully, one of you guys can help me.
I want to allow users to add a node to a JTree. I'm simulating this by using a button that looks at the current selection and adds a new node to it like this -
parentNode.add( childNode );
where parentNode and childNodes are DefaultMutableTreeNodes.
However this node is only ever visible if it was added to a branch that hasn't been expanded yet. Expanded branches don't get the new node.
What do I have to do to make the new node visible in expanded branches?
Lee.
Lee Feder
Greenhorn

Joined: Aug 11, 2000
Posts: 20
Don't worry, I fixed it.
Here's what the solution was (I can't believe it was so simple).

I am a chump!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New node in JTree not visible