1. conditional popup menu in jtree stackoverflow.comI want a conditional popup menu in jtree based upon which node i right click upon. Is it possible? I implemented it as follows but if I click on node at ... |
2. JTree and pop up menus coderanch.comHi All, I am doing a chat application (something similar to AOL). I have a JTREE in which i have the list of friends. When I right click on a node i am displaying a pop up menu which has options 1) Add 2) Remove 3) Edit On clicking the Edit option, I want to make the node editable. I am ... |
3. Jtree and Popup Menu coderanch.comYour node object should have some kind of id so you can tell the difference between nodes. When popping up menu you should do something like this: public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { TreePath path = myTree.getSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); Object nodeInfo = node.getUserObject(); MyObject mo = (MyObject)nodeInfo; MyPopupMenu popup = new MyPopupMenu(mo.getID()) ... |
4. Conditionalize popup menu for each node in JTree coderanch.comIs it possible to show a different list of items based on the node inside a JTree. I know how to show the menu for the whole tree, but can I have multiple menus in the tree... For example... Parent > Child 1 > Child 2 Can Parent have a menu that says, "New, Rename" and Child 1 have a menu ... |
5. PopUp Menu for JTree coderanch.com |