I have 2 trees in my program. Iam using JTree's clearselection() method to clear the selection in 1 tree when something in the other tree is selected. The main code is something like this:(inside a valueChanged event listener and tree being the one on which the current selection has been triggered)
if ( tree == tree1 ){
tree2.clearSelection();
} else {
tree1.clearSelection();
}
When I select for the first time, it works fine. But when I try to select from a different tree after this, it appears the valueChanged method is getting called twice. Any solution?