• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

How can i avoid the call to tree selection or how can a avoid method to get called written tree selection listener when a node in Jtree is collapsed.


I am using Jtree With root node name Alphanumeric.

Root has three nodes as node1, node2, node3.
Node1 contain three leaf node as leafnodeA, leafnodeB, leafnodeC.
Node2 contain three leaf node as leafnodeD, leafnodeE, leafnodeF.
Node3 contain three leaf node as leafnodeG, leafnodeH, leafnodeI.

When i selects multiple leafnode say leafnodeA, leafnodeE and leafnodeH. i am able to get all selected value.

when i collapse a node say node3, the tree selection listener gets called.
How can i avoid the call to  tree selection or how can avoid method to call written tree selection listener when a node is collapsed.

Any kind of help with code snippets is appreciated.
1 Solution
Sounds like its firing because the selection gets *unselected*
So in your listener you want to check if the selection was added and only take action if it is ie. ignore selections being removed.
Computer07Author Commented:
Thanks, now its working properly.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now