Solved

JTree question

Posted on 2001-08-26
3
702 Views
Last Modified: 2008-02-26
I have JTree which a fill with nodes at the first time.
After that a call removeAllChildren() method for some node and I am adding a brand new set of nodes as childrens for this node. Why the JTree doesn't changes? (There are only interrupted lines to previous childs which are still visible)!
0
Comment
Question by:msterjev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6427145
Sounds like your making calls on the tree node (as opposed to the model).
The tree node do not support firing TreeModelEvent's.
If you change your nodes you must also ensure that the matching events are fired by your tree model.
0
 
LVL 3

Author Comment

by:msterjev
ID: 6427539
The events are minor problem. Give me example how to dinamically change structure of one node( remove all its childrens and add new ones)!
0
 
LVL 92

Accepted Solution

by:
objects earned 20 total points
ID: 6427563
> The events are minor problem

No, events are the problem.
The Jtree updates itself according to events recieved from its tree model.

> Give me example how to ...

If you're using a DefaultTreeModel then just call treemodel.reload(node) after you've finished modifying the nodes children.



0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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 see all occupied ports on windows 10 laptop 15 93
Unhandled exception type Exception 18 63
ejb stateless example 2 62
Session in java desktop 5 34
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

738 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