Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jtree child selection problem

 
Kevin Magee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic