Here you can find the source of createEnumeration(String className, TreeNode root)
public static Enumeration<TreeNode> createEnumeration(String className, TreeNode root)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Constructor; import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; public class Main { public static Enumeration<TreeNode> createEnumeration(String className, TreeNode root) { try {//from w w w. j a v a 2 s . c om Class clazz = Class.forName("javax.swing.tree.DefaultMutableTreeNode$" + className); Constructor constructor = clazz.getDeclaredConstructor(DefaultMutableTreeNode.class, TreeNode.class); constructor.setAccessible(true); return (Enumeration<TreeNode>) constructor.newInstance(new DefaultMutableTreeNode(), root); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }