Solved

Add a DefaultMutableTreeNode to the root

Posted on 2002-05-19
5
253 Views
Last Modified: 2011-10-03
Hi,
I use the class MyJTree with one MyDefaultMutableTreeNode (as a root) in its MyDefaultTreeModel.
Where:

MyJTree extends JTree
MyDefaultMutableTreeNode extends DefaultMutableTreeNode
MyDefaultTreeModel extends DefaultTreeModel

When I add a child node, it only seen if I double-click the root.
I want it to be seen automatically.
How do I do this easily?
Thanks.
0
Comment
Question by:s_lavie
  • 3
5 Comments
 

Expert Comment

by:gsvikram
ID: 7019794
Add the tree the TreeExpansionListener.
Follow the JAVA API for the further methonds
0
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 7020569
Add a tree model listener to your model that expands a node when it is added to the tree.
0
 
LVL 2

Author Comment

by:s_lavie
ID: 7020887
It's not what I ask!
0
 
LVL 92

Expert Comment

by:objects
ID: 7020889
What did you ask then?
0
 
LVL 92

Expert Comment

by:objects
ID: 7020902
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 124
iterator/ListIterator approach 17 52
Java string replace 11 61
Java Eclipse Loop 3 29
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question