Add a DefaultMutableTreeNode to the root

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.
LVL 2
s_lavieAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
Add a tree model listener to your model that expands a node when it is added to the tree.
0
 
gsvikramCommented:
Add the tree the TreeExpansionListener.
Follow the JAVA API for the further methonds
0
 
s_lavieAuthor Commented:
It's not what I ask!
0
 
objectsCommented:
What did you ask then?
0
 
objectsCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.