• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

JTree editing

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've a JTree that I'm trying to edit,
however my userObject in my Node is a class with 2 strings and when I edit the tree my class gets overridden with the String that I enter.
Is there anyway override the function that causes this to happen? and update the userObject myself?
thanks
Trish
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess u can add some code in the tree editor to return a value- I guess it's the getCellEditorValue(). This method returns a value, so you return your string in this method.
 
Trisha Murphy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I decided to use the function prepareForEditing() from DefaultTreeCellEditor so that I can get and store the object and I update it and replace the new object in the function editingStopped(ChangeEvent e) from the CellEditorListener.
reply
    Bookmark Topic Watch Topic
  • New Topic