• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Update JTree Node without firing ValueChanged

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
reply
    Bookmark Topic Watch Topic
  • New Topic