JAVA TREE使用核心教程

	//更新GUI中的树
	void refreshTree() {
		//这里应该列取指定路径下的文件夹		
		rootNode.removeAllChildren();
		File dirFile = new File(getCurrentLocalProjectPath());
		File[] files = dirFile.listFiles();            	
		for(File file : files){
			DefaultMutableTreeNode node = new DefaultMutableTreeNode(
					file);
			rootNode.add(node);
			System.out.println(file.getAbsolutePath());
		}
		//tree.expandPath(new TreePath(rootNode));
		tree.updateUI();	    
	}
发布了217 篇原创文章 · 获赞 7 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/Hodors/article/details/102843006