📄 myfilefilter.java
字号:
/*
* @author 黎龙飞 , 创建日期 2008-5-3
*
* Blog : http://lilongfei1030.blog.163.com
*/
package stu.view;
import java.io.File;
import javax.swing.filechooser.FileFilter;
public class MyFileFilter extends FileFilter {
String ext;
public MyFileFilter(String ext) {
this.ext = ext;
}
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
}
String fileName = file.getName();
int index = fileName.lastIndexOf('.');
if (index > 0 && index < fileName.length() - 1) {
String extension = fileName.substring(index + 1).toLowerCase();
if (extension.equals(ext))
return true;
}
return false;
}
public String getDescription() {
return "File(*." + ext + ")";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -