JComponentPack 1.5.0

com.zfqjava.swing
Class DefaultFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by com.zfqjava.swing.DefaultFileFilter

public class DefaultFileFilter
extends FileFilter

DefaultFileFilter provides a default file filter.


Constructor Summary
DefaultFileFilter(String[] ext, String description)
          Constructs a default file filter use the specified ext and desciption.
DefaultFileFilter(String ext, String description)
          Constructs a default file filter use the specified ext and desciption.
 
Method Summary
 boolean accept(File f)
           
 String getDescription()
           
static String getExtensionName(File f)
          Returns the extension for the specified file, for example "readme.txt" will return "txt".
static String getExtensionName(String name)
          Returns the extension for the specified file name, for example "readme.txt" will return "txt".
static String getExtensionName(URL url)
          Returns the extension for the specified URL, for example "http://localhost/readme.txt" will return "txt".
 String[] getExtensionNames()
          Returns all the extension name for this file filter.
static String getNameWithoutExtension(String name)
          Returns the file name without extension, for example the file "readme.txt" will return "readme".
 String getPreferredExtensionName()
          Returns the preferred extension name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFileFilter

public DefaultFileFilter(String ext,
                         String description)
Constructs a default file filter use the specified ext and desciption.

Parameters:
ext - the extension name
description - the description for the extension
Throws:
NullPointerException - if any parameter is null.

DefaultFileFilter

public DefaultFileFilter(String[] ext,
                         String description)
Constructs a default file filter use the specified ext and desciption.

Parameters:
ext - the extension names
description - the description for the extension
Throws:
NullPointerException - if any parameter is null.
Method Detail

accept

public boolean accept(File f)
Specified by:
accept in class FileFilter

getDescription

public String getDescription()
Specified by:
getDescription in class FileFilter

getPreferredExtensionName

public String getPreferredExtensionName()
Returns the preferred extension name.

Returns:
the preferred extension name
Since:
JDataGrid 1.7.0

getExtensionNames

public String[] getExtensionNames()
Returns all the extension name for this file filter.

Returns:
all the extension name for this file filter
Since:
JDataGrid 1.7.0

getExtensionName

public static String getExtensionName(File f)
Returns the extension for the specified file, for example "readme.txt" will return "txt".

Parameters:
f - the file
Returns:
the extension
Since:
JDataGrid 2.0

getExtensionName

public static String getExtensionName(URL url)
Returns the extension for the specified URL, for example "http://localhost/readme.txt" will return "txt".

Parameters:
url - the url
Returns:
the extension
Since:
JDataGrid 2.0.2

getExtensionName

public static String getExtensionName(String name)
Returns the extension for the specified file name, for example "readme.txt" will return "txt".

Parameters:
name - the file name
Returns:
the extension
Since:
JDataGrid 2.0.2

getNameWithoutExtension

public static String getNameWithoutExtension(String name)
Returns the file name without extension, for example the file "readme.txt" will return "readme".

Parameters:
name - the file name
Returns:
the file name without extension
Since:
JDataGrid 2.0.2

JComponentPack 1.5.0

Send your Feedback
JComponentPack 1.5.0
Copyright © 2001-2007 Extreme Component, Inc. All rights reserved.