TreeNode loadFilePaths(String rootPath)
  {
  File path=new File(rootPath);
  DefaultMutableTreeNode root=new
  DefaultMutableTreeNode(path.getName().trim());
  DefaultTreeModel model=new DefaultTreeModel(root);
  File[] childsOfPath=path.listFiles();
  for(int i=0;i<=childsOfPath.length-1;i++){
   if( !childsOfPath[i].isHidden()){         //判断一下是否是隐藏文件就行了
     String name=childsOfPath[i].getName().trim();
     if(childsOfPath[i].isDirectory()){
       DefaultMutableTreeNode childRoot;
       childRoot=(DefaultMutableTreeNode)
            loadFilePaths(childsOfPath[i].getAbsolutePath());
     if(childRoot.getChildCount()>0) root.add(childRoot);
     }
     else{
       DefaultMutableTreeNode childRoot=new DefaultMutableTreeNode(name);
       root.add(childRoot);
     }
   }
  }
  return root;
 }