Java examples for Swing:JTree
create Folder Node DefaultMutableTreeNode
//package com.java2s; import javax.swing.tree.DefaultMutableTreeNode; public class Main { public static void main(String[] argv) throws Exception { String folderName = "java2s.com"; System.out.println(createFolderNode(folderName)); }/* w w w . j a v a 2 s .co m*/ static DefaultMutableTreeNode createFolderNode(final String folderName) { DefaultMutableTreeNode newFolder = new DefaultMutableTreeNode( folderName) { public boolean isLeaf() { return false; } }; return newFolder; } }