tree.stopEditing();
tree.cancelEditing();  TreePath op = event.getOldLeadSelectionPath(); TreePath np = event.getNewLeadSelectionPath();   if (op != np) { Rectangle o = treeState.getBounds(event.getOldLeadSelectionPath(), new Rectangle()); Rectangle n = treeState.getBounds(event.getNewLeadSelectionPath(), new Rectangle());  if (o!=null) tree.repaint(o); if (n!=null) tree.repaint(n); }
    public void valueChanged(TreeSelectionEvent event)    {      if (tree.isEditing())        tree.stopEditing();    }