DefaultMutableTreeNode (@NotNull Object object, Object... children) { if (object instanceof DefaultMutableTreeNode && ArrayUtil.isEmpty(children)) return (DefaultMutableTreeNode)object; if (object instanceof TreeNode) throw new IllegalArgumentException("do not use a tree node as a node content"); DefaultMutableTreeNode node = new DefaultMutableTreeNode(object); for (Object child : children) node.add(node(child)); return node; }