rootNode.add(projectNode); navigatorTree.setSelectionPath(new TreePath(new Object[]{rootNode, projectNode}));
DefaultTreeModel treeModel = (DefaultTreeModel) navigatorTree.getModel(); treeModel.insertNodeInto(projectNode, rootNode, rootNode.getChildCount()); TreePath projPath = new TreePath(new Object[]{rootNode, projectNode}); navigatorTree.makeVisible(projPath); navigatorTree.setSelectionPath(projPath);
    private void newProjectItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newProjectItemActionPerformed        Project project = new Project(UNTITLED_PROJECT);        projectCollection.addProject(project);        DefaultMutableTreeNode projectNode = new DefaultMutableTreeNode(project);        rootNode.add(projectNode);        navigatorTree.setSelectionPath(new TreePath(new Object[]{rootNode, projectNode}));    }//GEN-LAST:event_newProjectItemActionPerformed