给个提示,比如出了什么错误,不让怎么解决呀

解决方案 »

  1.   

    private TreeNode  loadFilePaths(String rootPath){
        StatusBar.setText("  ");
        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++){
            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 {
              int  c=name.lastIndexOf(".")  ;
               String fileType=name.substring(c+1).toUpperCase();
              if(fileType.equals("JPG") ||fileType.equals("GIF") ){
                   DefaultMutableTreeNode childRoot=new DefaultMutableTreeNode(name);
                   root.add(childRoot);
               }
            }
        }    return root;  }
    这个函数返回NULL
      

  2.   

    运行了,没什么问题啊,图片看的了的
      

  3.   

    是不是因为我的D盘有空目录?
      

  4.   

    我试过了 代码没有问题 是因为D盘太大了
    请问这种方式编程合理吗?
      

  5.   

    运行好慢,好多异常,慢慢研究