hi, I have a JTree which roughly looks like this: 0.root 1.child1 1.1.leaf 1.2.leaf 2.child2 2.1.leaf 2.2.leaf I've added a right click JPopUpMenu in order carry out various functions on particular nodes in the tree. A different menu appear depending on whether the node is a child or a leaf. This menu uses the mouse event location in order to select the relevant node. The menu system itself works fine. However, I'm also trying to delete and add notes to the 1st level (the child nodes in the diagram) however, I can't seem to properly select them, the root is selected instead. here's the code:
Any ideas on how to select the correct node, any help would be greatly appreciated.
posted 13 years ago
have you checked what tree path is returned for the call to
? is this the path you want to select or the path that gets actually selected? be sure that getExpandsSelectedPath() is set to true. c