tree.scrollPathToVisible(lead);
tree.scrollPathToVisible(tree.getLeadSelectionPath());
    public void actionPerformed(ActionEvent e)    {      String command = e.getActionCommand();      TreePath lead = tree.getLeadSelectionPath();      if (command.equals("selectPreviousChangeLead")          || command.equals("selectPreviousExtendSelection")          || command.equals("selectPrevious") || command.equals("selectNext")          || command.equals("selectNextExtendSelection")          || command.equals("selectNextChangeLead"))        (new TreeIncrementAction(0, "")).actionPerformed(e);      else if (command.equals("selectParent") || command.equals("selectChild"))        (new TreeTraverseAction(0, "")).actionPerformed(e);      else if (command.equals("selectAll"))            {          TreePath[] paths = new TreePath[treeState.getRowCount()];          for (int i = 0; i < paths.length; i++)            paths[i] = treeState.getPathForRow(i);          tree.addSelectionPaths(paths);        }      else if (command.equals("startEditing"))        tree.startEditingAtPath(lead);      else if (command.equals("toggle"))        {          if (tree.isEditing())              tree.stopEditing();          else            {              Object last = lead.getLastPathComponent();              TreePath path = new TreePath(getPathToRoot(last, 0));              if (! treeModel.isLeaf(last))                toggleExpandState(path);            }        }      else if (command.equals("clearSelection"))        tree.clearSelection();      if (tree.isEditing() && ! command.equals("startEditing"))        tree.stopEditing();      tree.scrollPathToVisible(lead);    }