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

📄 myfilefilter.java

📁 SNP算法: 基于背景缩减和阴影检测的统计方法,适用于室内检测.
💻 JAVA
字号:
/*
 * @(#)MyFileFilter.java	1.0 05/07/25
 *
 * Copyright (c) 2005- Joe King. All rights reserved.
 *
 * This source file may not be copied, modified, or redistributed
 * EXCEPT as allowed by the following statements: You may freely use
 * this file for your own work, including modifications and distribution
 * in compiled (class files, native executable, etc.) form only. You may
 * not copy and distribute this file. You may not remove this copyright
 * notice. You may not distribute modified versions of this source file.
 * You may not use this file in printed media without the express
 * permission of Joe King. 
 *
 * JOE KING MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
 * SUITABILITY OF THIS SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR PARTICULAR PURPOSE, OR NON-INFRINGEMENT. BILL VENNERS SHALL NOT
 * BE LIABLE FOR ANY DAMAGES SUFFERED BY A LICENSEE AS A RESULT OF
 * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */
 package bin;
 
 import java.io.*;
 import java.util.*;
 import javax.swing.filechooser.FileFilter;
 
 /**
 * This file filter matches all files with a given
 * set of extensions.
 *
 * @author Joe King
 * @version 1.0, 05/07/25
 */
 public class MyFileFilter extends FileFilter{
 	
 	private String description="";
 	private ArrayList extensions=new ArrayList();
 	  
 	/**
 	 * Adds an extension that this file filter
 	 * recongizes.
 	 */	
 	 public void addExtension(String extension){
 	 	if(!extension.startsWith("."))
 	 		extension="."+extension;
 	 	extensions.add(extension.toLowerCase());	
 	 }
 	 /**
 	  * sets a description for the file  set
 	  * that this file filter recongnizes.
 	  */
 	  public void setDescription(String desc){
 	  	description=desc;
 	  }
 	  public String getDescription(){
 	  	return description;
 	  }
 	  /**
 	   * check the file name is legal or not.
 	   */
 	  public boolean accept(File f){
 	  	if(f.isDirectory())return true;
 	  	
 	  	String name=f.getName().toLowerCase();
 	  	for(int i=0;i<extensions.size();i++){
 	  		if(name.endsWith((String)extensions.get(i)))
 	  			return true;
 	  	}
 	  	return false;
 	  }
 	  
 }

⌨️ 快捷键说明

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