JFileChooser帮助 [英] JFileChooser Help
本文介绍了JFileChooser帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JFileChooser finder = new JFileChooser();
finder.setFileFilter(new FileNameExtensionFilter(null,.zip));
这似乎对我来说运行正常,但是当我去一个.zip文件夹文件,.zip文件是灰色的,我不能选择它们。我该如何解决?另外,作为一个问题,我如何摆脱JFileChooser窗口中的所有文件选项?
解决方案
使用zip
作为扩展过滤器,而不是。zip
。
I am attempting to make a program, and it involves a JFileChooser. I am trying to make it so that the users can only pick .zip files. My code is
JFileChooser finder = new JFileChooser();
finder.setFileFilter(new FileNameExtensionFilter(null, ".zip"));
This seems to me like it would run fine, however when I go to a folder with a .zip file, the .zip files are gray, and I can't choose them. How do I fix this? Also, as a side question, how do I get rid of the "All Files" option in the JFileChooser window?
解决方案
Use "zip"
as an extension filter, not ".zip"
.
这篇关于JFileChooser帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文