Updating jtree

When I want to update it and change it's nodes in another part of my program (while program is running, as an action performed) I try to add new nodes, or remove nodes to it; But my interface doesn't change.

Hi, i'm relatively new to java, and i have a question about JTrees.

might work for someone /** * Checks which nodes are visible throught the JTREE, reloads the tree, * and set those nodes visible again */ public void reload Tree() { Object Node selected Node = Selected Node(); ...

Hi, This is becoz the JTREE is not getting refreshed after the new node is added to the DB.

but I have a drop down list that can select which years to display (1-4th year).

I want the tree in the scroll Pane to update when u change the year in the drop down list.

updating jtree-61updating jtree-13updating jtree-63updating jtree-4

I have used code like: // Wrap the child in a Default Mutable Tree Node and // add it to the tree. target.add(new Default Mutable Tree Node(new Item)); my Structure Changed(target); // Add the new child to the parent. I didn�t quite understand why to add childs as I am only editing existing nodes (but may change in the future...). Some idea on this if you know the position of the node to be changed, after do a reload, you can child Node is the node being changed.This can be done by using CACHE concept(Like u use in the WEBLOGIC).U write a method just after u add a NODE to the JTREE.I know there are lots of topics posted already concerning this question but i didn�t find a solution yet...[maybe because i`m new to java & couldn�t use them in the right way...] Any ideas? Tom Use Default Tree Model to track the changes in the tree structure.If you aren't getting that many updates all the time, you could implement something where the listener fires to an intermediate listener which will fire the info to the tree after a slight delay.

You must have an account to comment. Please register or login here!