File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Renaming tree node with JPopupMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Renaming tree node with JPopupMenu" Watch "Renaming tree node with JPopupMenu" New topic

Renaming tree node with JPopupMenu

Sudhakar Krishnamurthy
Ranch Hand

Joined: Jun 02, 2003
Posts: 76
I am a newbie to swing, i need help to get started with...
I have a JTree with few nodes, on right clicking i should be able to popup a menu that contains option for renaming the node and when the user clicks on the menu option the node should be renamed, the new name should be validated for text only characters.
I have been able to get to the point where i am able to display the popup menu...need help from there. Not sure where i would do all the validation, in actionPerformed or do i have to have some kind of listeners..???
If any one can post a code fragment or point me to a example code, it'll be greatly appreciated.
I agree. Here's the link:
subject: Renaming tree node with JPopupMenu
It's not a secret anymore!