Solved

Add a DefaultMutableTreeNode to the root

Posted on 2002-05-19
5
230 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HashMap Vs TreeMap 12 55
Free Alternative to JIRA 4 91
looking for unix program to search some keywords in side EAR WAR and JAR files 10 81
xampp tool 12 25
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now