else if (e.getActionCommand().equals("toggle"))
else if (command.equals("toggle"))
    public void actionPerformed(ActionEvent e)    {      TreePath lead = tree.getLeadSelectionPath();      if (e.getActionCommand().equals("selectPreviousChangeLead")          || e.getActionCommand().equals("selectPreviousExtendSelection")          || e.getActionCommand().equals("selectPrevious")          || e.getActionCommand().equals("selectNext")          || e.getActionCommand().equals("selectNextExtendSelection")          || e.getActionCommand().equals("selectNextChangeLead"))        (new TreeIncrementAction(0, "")).actionPerformed(e);      else if (e.getActionCommand().equals("selectParent")               || e.getActionCommand().equals("selectChild"))        (new TreeTraverseAction(0, "")).actionPerformed(e);      else if (e.getActionCommand().equals("selectAll"))        {          TreePath[] paths = new TreePath[tree.getVisibleRowCount()];          Object curr = getNextVisibleNode(treeModel.getRoot());          int i = 0;          while (curr != null && i < paths.length)            {              paths[i] = new TreePath(getPathToRoot(curr, 0));              i++;            }          tree.addSelectionPaths(paths);        }      else if (e.getActionCommand().equals("startEditing"))        tree.startEditingAtPath(lead);      else if (e.getActionCommand().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 (e.getActionCommand().equals("clearSelection"))        tree.clearSelection();      if (tree.isEditing() && !e.getActionCommand().equals("startEditing"))        tree.stopEditing();      tree.scrollPathToVisible(lead);    }