Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • 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.


Hi

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.
Thanks.
0
Computer07
Asked:
Computer07
1 Solution
 
objectsCommented:
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.
0
 
Computer07Author Commented:
Thanks, now its working properly.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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