• Post Reply Bookmark Topic Watch Topic
  • New Topic

Making JTree node editable on cliking a button  RSS feed

 
venkat paruchuri
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using JTree in my application. I can edit the tree node just by single mouse click and some pause or triple click on the node. I want to accomplish it using keyboard. For this, I have to provide menu item that should enable me editing the node (as in windows OS). I appreciate if anybody can help me in achieving this. Thanks in advance.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your menuitem should call myTree.startEditingAtPath( TreePath tp ), where tp indicates the path to the node you are editing. You can also add a KeyListener to the JTree to call this method without using a MenuItem...

-Nate
 
venkat paruchuri
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan,
Thank you very much for your help. It worked well for me. once again thanks a lot
venkat
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!