JPopupMenu « JTree « Java Swing Q&A





1. Show/Hide JMenuItems in a JPopupMenu based on a JTree's selection    stackoverflow.com

I have a JTree which displays a JPopupMenu when I right click nodes in the JTree. What is the best way to hide/show or enable/disable certain JMenuItems in my JPopupMenu based ...

2. Problem with JPopupMenu in a JTree    stackoverflow.com

Hi guys I have this issue. In a custom JTree I implemented a JPopupMenu to display different JMenuItem according to the node selected using a MouseListener. The JPopupMenu is shown when the ...

3. JTree inside a JPopupMenu    coderanch.com

4. JPopupMenu inside a Jtree    coderanch.com

final JPopupMenu popupMenu = new JPopupMenu(); JMenuItem shutdownMenuItem = new JMenuItem("shutdown"); popupMenu.add(shutdownMenuItem); tree.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { if (popupMenu.isPopupTrigger(e)) { System.out.println("please be a popup trigger"); } int selectedRow = tree.getRowForLocation(e.getX(), e.getY()); if (selectedRow != -1) { if (SwingUtilities.isRightMouseButton(e) == true) { tree.setSelectionRow(selectedRow); popupMenu.show(tree, e.getX(), e.getY()); } } } });

5. Renaming tree node with JPopupMenu    coderanch.com

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 ...