Solved

JTree question

Posted on 2001-08-26
3
695 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
Comment Utility
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
Comment Utility
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
Comment Utility
> 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

771 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

10 Experts available now in Live!

Get 1:1 Help Now