📄 filter.java
字号:
package bookmanage;
import javax.swing.filechooser.*;
import java.io.File;
/**
* <p>Title: 图书管理系统</p>
*
* <p>Description: Filter是用来过滤文件的</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: 浙江工业大学信息学院计算机系</p>
*
* @author 曾文秋
* @version 1.0
*/
public class Filter extends FileFilter {
String str;
public Filter(String str) {
this.str="."+str;
}
/**
* Whether the given file is accepted by this filter.
*
* @param f File
* @return boolean
* @todo Implement this javax.swing.filechooser.FileFilter method
*/
public boolean accept(File f) {
if(f.isDirectory()) return true;
String name=f.getName();
return name.endsWith(str);
}
/**
* The description of this filter.
*
* @return String
* @todo Implement this javax.swing.filechooser.FileFilter method
*/
public String getDescription() {
if(str.equals(".xls"))
return "Microsoft office Excel (*.xls)";
return "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -