⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notepad_filefilter.java

📁 java 编写的代码
💻 JAVA
字号:
/**
 * 
 */
package com.edu.sccp.snail.notepad.view;

import java.io.File;

import javax.swing.filechooser.FileFilter;

/**
 * @author 小豆包
 * @return 文件过滤 
 * @time 2008-1-7
 */
public class Notepad_FileFilter extends FileFilter {
	  private String ext;	  
	  public Notepad_FileFilter(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() {
	    if (ext.equals("java")) {
	      return "JAVA Source File(*.java)";
	    }
	    if (ext.equals("html")) {
	      return "HTML Source File(*.html)";
	    }
	    if (ext.equals("txt")) {
	      return "Text File(*.txt)";
	    }
	    if(ext.equals("jsp")) {
	      return "Java Server Pages File(*.jsp)";
	    }if(ext.equals("exe")) {
	      return "二进制文件 (*.exe)";
	    }
	      return "";
	  }
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -