Solved

Add a DefaultMutableTreeNode to the root

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
micro services spring boot application error 3 194
thymeleaf natural templating vs JSP 2 99
hibernate example issues from command prompt 10 41
Java: anonymous class 4 20
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…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

777 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