How can I unselect a JTree node selection?
Created May 4, 2012
Sandip Chitale To unselect all the tree node selection.
Use the following method of JTree.
Altenatively you could get the current selection of nodes using the following methods -
public void clearSelection();
This works great for SINGLE_TREE_SELECTION mode.
public int[] getSelectionRows() // row based
public TreePath[] getSelectionPaths() // tree path based
then remove from the retuned arrays the row index or TreePath that you want to unselect and the use the corresponding 'set' methods.