tPath = lastPath; lastPath = e.getNewLeadSelectionPath(); lastRow = tree.getRowForPath(lastPath); stopCellEditing();
if (tree != null) { if (tree.getSelectionCount() == 1) lastPath = tree.getSelectionPath(); else lastPath = null; }
  public void valueChanged(TreeSelectionEvent e)  {    tPath = lastPath;    lastPath = e.getNewLeadSelectionPath();    lastRow = tree.getRowForPath(lastPath);    stopCellEditing();  }