I have a JTree to let the user build folders and items (nodes) interactively. This is done by rightclicking an existing node, a listener then opens a popup with some options... The problem is that I cannot show a popup menu when the user clicks on the ROOT node (wich seems to be default in a JTree). The listener isn't even activated when one clicks the ROOT.
I have a listener attached to the JTree:
tree.addTreeSelectionListener(new TreeSelListener()); //when node is selected
tree.addMouseListener(new PopupMenuListener()); //when tree is clicked
Following class is always triggered when a node is clicked, except for the ROOT node :
private class TreeSelListener implements TreeSelectionListener
Any ideas on this one?