Solved

JTree question

Posted on 2001-08-26
3
700 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven module vs maven project 3 46
Selenium docs api java index 3 48
Tagging and Merging on Branch 1 29
American Express @Work site and Java 4 11
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

791 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