tree.expandPath(new TreePath(mod.getRoot()));
{ TreePath path = new TreePath(mod.getRoot()); if (!tree.isExpanded(path)) toggleExpandState(path); }
  public void installUI(JComponent c)  {    tree = (JTree) c;    configureLayoutCache();        UIDefaults defaults = UIManager.getLookAndFeelDefaults();    tree.setFont(defaults.getFont("Tree.font"));    tree.setForeground(defaults.getColor("Tree.foreground"));    tree.setBackground(defaults.getColor("Tree.background"));    tree.setOpaque(true);    tree.setScrollsOnExpand(defaults.getBoolean("Tree.scrollsOnExpand"));    rightChildIndent = defaults.getInt("Tree.rightChildIndent");    leftChildIndent = defaults.getInt("Tree.leftChildIndent");    setRowHeight(defaults.getInt("Tree.rowHeight"));    tree.requestFocusInWindow(false);        setExpandedIcon(defaults.getIcon("Tree.expandedIcon"));    setCollapsedIcon(defaults.getIcon("Tree.collapsedIcon"));        currentCellRenderer = createDefaultCellRenderer();    rendererPane = createCellRendererPane();    createdRenderer = true;    setCellEditor(createDefaultCellEditor());    createdCellEditor = true;    TreeModel mod = tree.getModel();    setModel(mod);    if (mod != null)      tree.expandPath(new TreePath(mod.getRoot()));    treeSelectionModel = tree.getSelectionModel();    drawingCache = new Hashtable();    nodeDimensions = createNodeDimensions();        propertyChangeListener = createPropertyChangeListener();    focusListener = createFocusListener();    treeSelectionListener = createTreeSelectionListener();    mouseInputListener = new MouseInputHandler(null, null, null);    keyListener = createKeyListener();    selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();    componentListener = createComponentListener();    cellEditorListener = createCellEditorListener();    treeExpansionListener = createTreeExpansionListener();    treeModelListener = createTreeModelListener();    editingRow = -1;    lastSelectedRow = -1;        installKeyboardActions();        tree.addPropertyChangeListener(propertyChangeListener);    tree.addFocusListener(focusListener);    tree.addTreeSelectionListener(treeSelectionListener);    tree.addMouseListener(mouseInputListener);    tree.addKeyListener(keyListener);    tree.addPropertyChangeListener(selectionModelPropertyChangeListener);    tree.addComponentListener(componentListener);    tree.addTreeExpansionListener(treeExpansionListener);    if (treeModel != null)      treeModel.addTreeModelListener(treeModelListener);        completeUIInstall();  }