posted 21 years ago
Is it possible to revert the jtree node selection to it's previous selection when i see a flag set.
i.e, say node A is selected. User new selects node B while flag is true. I want the node selection to be reverted back so that node A is selected again.
I am using the following code in valueChanged() method of TreeSelectionListener class. but, this keeps calling itself and hence not a good code. any other way(s)?
JTree jtree = (JTree)event.getSource();
if(f_IsAddTempNode) {
TreePath oldPath = event.getOldLeadSelectionPath();
EuamDefaultMutableTreeNode node = (EuamDefaultMutableTreeNode)oldPath.getLastPathComponent();
setTreeSelection(jtree, node);
return;
}
Thanks.