I have a JTree with editable nodes.
How can I programmatically trigger the tree cell edit event, i.e. bring up the node-renaming textbox in place of a highlighted node, as if the user manually highlighted it and pressed F2?
Basically I want to add a “Rename” menu item or toolbar button, to clue users in on that particular function of the tree, and I want it to function identically to an F2 keypress when the user highlights a node.
1) some node is selected (by
Mouse/KeyBoardevent) and by listening byTreeSelectionListener, then selected path has unique ID2) add
Swing ActiontoJMenuItem(inJPopup???, not clear from your question, how to get node from /to ???)3) create class, void, whatever and to fire
4) based on answer by
@Michael Dunnto my question on another forum