Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Renaming treenodes  RSS feed

 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody know how to deal with renaming tree nodes? All the UI stuff seems to be implemented in the Default implementation, but I can't figure out how to query my tree to find out this has happened, and inform my objects:
public void valueChanged(TreeSelectionEvent tse) {
Node node = (Node)searchTree.getLastSelectedPathComponent();
...if the name of the node was changed....
node.getUserObject().setTitle(newName);
The tree selection event doesn't seem to have any applicable methods...
If you don't know the answer, stick around, and I'll probably post it pretty soon :^)
later!

 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'm getting closer. The default tree contains a CellEditor Listener, which handles these events in its editingStopped method. So I tried adding such a listener to my tree, and implementing the appropriate method. But I still can't figure out where the newly edited text is stored....
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I found out some more: this code looks promising, but it's still not working:

Anybody??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!