• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree editing  RSS feed

 
Trisha Murphy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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
 
Venkata Cherukuri
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!