• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jtree child selection problem

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic