?? javafilefilter.java
字號:
/*
* 11/14/2003
*
* JavaFileFilter - A FileFilter that filters everything except .java files.
* Copyright (C) 2003 Robert Futrell
* email@address.com
* www.website.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.fife.ui.rtextfilechooser.filters;
import java.io.File;
import javax.swing.filechooser.*;
/**
* A file filter for <code>JFileChooser</code>s that filters everything except *.java files.
*/
public class JavaFileFilter extends FileFilter {
//Accept all directories and all .txt files.
public boolean accept(File f) {
// Accept the "file" if it is a directory.
if (f.isDirectory()) {
return true;
}
// Get the extension of the file.
String extension = null;
String s = f.getName();
int i = s.lastIndexOf('.');
if (i>0 && i<s.length()-1)
extension = s.substring(i+1).toLowerCase();
// Now, accept the file ONLY if it is a .txt file.
if (extension!=null && extension.equals("java"))
return true;
// Any other files are not accepted by this filter.
return false;
}
// The description of this filter.
public String getDescription() {
return "Java Source Files (*.java)";
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -