if (nc > 0) node = treeModel.getChild(node, 0);  TreePath path = current.pathByAddingChild(node); selectPath(tree, path);
if (nc == 0 || treeState.isExpanded(current)) {   int nextRow = tree.getLeadSelectionRow() + 1; if (nextRow <= tree.getRowCount()) tree.setSelectionRow(nextRow); } else { tree.expandPath(current); }
    public void actionPerformed(ActionEvent e)    {      TreePath current = tree.getLeadSelectionPath();      if (current == null)        return;      if (e.getActionCommand().equals("selectParent"))        selectPath(tree, current.getParentPath());      else if (e.getActionCommand().equals("selectChild"))        {          Object node = current.getLastPathComponent();          int nc = treeModel.getChildCount(node);          if (nc > 0)            node = treeModel.getChild(node, 0);          TreePath path = current.pathByAddingChild(node);          selectPath(tree, path);        }    }