DefaultMutableTreeNode (final TemplateGroup newGroup) { myTemplateGroups.add(newGroup); int index = getIndexToInsert(myTreeRoot, newGroup.getName()); DefaultMutableTreeNode groupNode = new CheckedTreeNode(newGroup); myTreeRoot.insert(groupNode, index); ((DefaultTreeModel)myTree.getModel()).nodesWereInserted(myTreeRoot, new int[]{index}); return groupNode; }