aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Update JTree Node without firing ValueChanged Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Update JTree Node without firing ValueChanged " Watch "Update JTree Node without firing ValueChanged " New topic
Author

Update JTree Node without firing ValueChanged

John Ryan
Ranch Hand

Joined: Mar 14, 2001
Posts: 124
Hi everyone,
Hi,
I have implemented my own Tree Model which i use to manage the objects i am adding to the JTree. On the right hand side of my GUI i display the attributes of my tree nodes. These attributes including the node name, are editable. My problem is that when i change the node name on the right hand side of the GUI i update the user object corresponding to that node. I am then updating the GUI using model.reload. However this seems to fire off a valueChanged event on the TreeListener which is causing all sorts of problems for me ( It also means that the selected node is set to null. I do not want to lose my selected node). I do not want to change the selected node, but merely to update the GUI to reflect the new node name.
Because the valueChanged event is being fired i am getting a circular type of event handling where the selection of a node updates the right hand side, and then a change in one of the attributes causes the the selected node to change and again updates the right hand side. How do i prevent this?
Any suggestions appreciated....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Update JTree Node without firing ValueChanged