jpgfilter.java

来自「实现对owl-s描述服务的检索」· Java 代码 · 共 53 行

JAVA
53
字号
/* 
 * OWL-S Matchmaker
 * 
 * COPYRIGHT NOTICE
 * 
 * Copyright (C) 2005 DFKI GmbH, Germany
 * Developed by Benedikt Fries, Matthias Klusch
 * 
 * The code is free for non-commercial use only.
 * You can redistribute it and/or modify it under the terms
 * of the Mozilla Public License version 1.1  as
 * published by the Mozilla Foundation at
 * http://www.mozilla.org/MPL/MPL-1.1.txt
 */
package owlsmx.gui.util.filefilter;

import java.io.File;

import javax.swing.filechooser.FileFilter;

public class JPGFilter extends FileFilter  implements java.io.Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 5012601654392224589L;

	//Accept all directories and all gif, jpg, tiff, or png files.
    public boolean accept(File f) {
    	if (f.isDirectory())
    		return true;
        if (f.getAbsolutePath().indexOf(".")<0) {
            return false;
        }
        
        String extension = f.getAbsolutePath().toLowerCase();
        if (extension != null) {
        extension = extension.substring(extension.lastIndexOf("."));        
        	if (extension.indexOf("jpg")>=0)
	                    return true;
	        else
	        	return false;	            
	        }

	    return false;
    	}

    //The description of this filter
    public String getDescription() {
    	return "JPG";
    }
	
}

⌨️ 快捷键说明

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