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

📄 m_filefilter.java

📁 自己用Java写的一个mp3文件改名的小工具
💻 JAVA
字号:
import java.io.File;

/**
 *  Description of the Class
 *
 * @author     kilo
 * @created    2003年12月22日
 */
public final class m_FileFilter
		 extends javax.swing.filechooser.FileFilter {
	/**
	 *  Description of the Field
	 */
	protected boolean dirInclude;
	/**
	 *  Description of the Field
	 */
	protected String exName;


	/**
	 *  Constructor for the m_FileFilter object
	 *
	 * @param  dirInclude  Description of the Parameter
	 * @param  exName      Description of the Parameter
	 */
	public m_FileFilter( boolean dirInclude, String exName ) {
		this.dirInclude = dirInclude;
		this.exName = exName;
	}


	/**
	 *  Gets the extension attribute of the m_FileFilter class
	 *
	 * @param  f  Description of the Parameter
	 * @return    The extension value
	 */
	private static String getExtension( File f ) {
	String ext = null;
	String s = f.getName();
	int i = s.lastIndexOf( '.' );

		if ( i > 0 && i < s.length() - 1 )
			ext = s.substring( i + 1 ).toLowerCase();

		else
			return "";
		return ext;
	}


	/**
	 *  Description of the Method
	 *
	 * @param  f  Description of the Parameter
	 * @return    Description of the Return Value
	 */
	public boolean accept( File f ) {
		if ( f.isDirectory() && dirInclude == true )
			return true;
		else if ( f.isDirectory() && dirInclude == false )
			return false;
		else {
		String cExtension = getExtension( f );
			if ( cExtension.compareToIgnoreCase( exName ) == 0 )
				return true;
			return false;
		}
	}


	/**
	 *  Gets the description attribute of the m_FileFilter object
	 *
	 * @return    The description value
	 */
	public String getDescription() {
		return "mp3 music Files";
	}

}

⌨️ 快捷键说明

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