• Post Reply Bookmark Topic Watch Topic
  • New Topic

Prevent JTree Leaf Expand/Doubleclick

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I cannot get my JTree to not expand a leaf node when doubleclicking it. I would like to prevent the expansion. I know the name of the directory, or in other word, I can detect it being clicked on. Look at
DocumentTree.this.synopsisDir(path), I thought the retun keyword would prevent this. I don't want this node to expand because I want the contents untouched.

 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a TreeWillExpandListener, then veto the expanding using a ExpandVetoException.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob, it was very easy to get the proper results using the following:




Thanks so much for pointing me in the right direction.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!