You can do this by using the method fireValueChanged( treeSelectionEvent )
try this out for the root node
TreePath treePath=new TreePath(rootNode);
TreeSelectionEvent event=new TreeSelectionEvent(tree, treePath, false, tree.getLeadSelectionPath(), treePath);
tree.fireValueChanged(event);
i think u know about the key listeners which also be used for ur problem.
Hope this will show u the Path
Shahid
just implement ur Jtree class with TreeSelectionListener
and add
this.getSelectionModel().setSelectionModeTreeSelectionModel.SINGLE_TREE_SELECTION); or multi selct if required
this.addTreeSelectionListener(this);
and just overide the valuechanged method()
that is it
it will work no firevalue n all
hope it works cos it works for me
cheers