How to add child node on right click of a node to a JTree
posted 6 years ago
I have to add a child new node on right click of a parent node to JTree. The JTree should work same as tree works while we explore things in myComputer.
Please tell me if it is possible or not? If yes then please help me to do this...
Upon right clicking (use a MouseListener and its isPopupTrigger method), you create a new TreeNode (usually DefaultMutableTreeNode), retrieve the model from the JTree, and call its insertNodeInto method: