首页 > 其他 > 详细

JFileChooser过滤器

时间:2014-04-20 11:22:30      阅读:502      评论:0      收藏:0      [点我收藏+]

       JFileChooser fd = new JFileChooser();  

       //用内部匿名类自定义过滤器,只看见txt文件       

      fd.setFileFilter(new FileFilter() {

            @Override            

               public boolean accept(File f) {                

                          if (f.isDirectory()) {                    

                                  return true;

                                 }               

                 return f.getName().endsWith(".txt");         

                }

            @Override          

             public String getDescription() {    

             return ".txt";

            }      

   });

JFileChooser过滤器,布布扣,bubuko.com

JFileChooser过滤器

原文:http://www.cnblogs.com/lxm123/p/3675443.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!