jbcl.control Package
java.lang.Object +----com.borland.jbcl.control.Filer
Variables Constructors Properties Methods
Implements WindowListener, Serializable, EventListener
The Filer
component display an Open or Save As dialog
box for opening or saving files. The dialog box displays a list
of directories and files the user can use to select a file to
open or save. The value of the mode
property determines
whether the dialog box is an Open or Save As dialog box.
The value of the directory
property determines which
directory is displayed in the dialog box. If the file
property has a specified value, that specified file is the
selected file in the dialog box, and when the user selects a file
in the dialog box, that file becomes the value of the file
property.
The value of the filenameFilter
specifies the filter
this dialog box displays. filenameFilter
is of type FilenameFilter
,
which is an interface. You must create a class that implements
this interface to provide a filter for the dialog box.
You can make the Filer
component appear at design
time:
StringInput
component on the UI
Designer or on the Component Tree. frame
property to this in
the Component Inspector. visible
property to true.
To display the dialog box at runtime, call the show()
method or set the visible
property to true.
protected FileDialog dialog
protected String dir
protected String file
protected transient FilenameFilter filter
protected Frame frame
public static final int LOAD = FileDialog.LOAD
protected int mode
public static final int SAVE = FileDialog.SAVE
protected String title
public Filer()
Constructs a File Open dialog box with no title-bar text.
public Filer(Frame frame)
Constructs a File Open dialog box with the specified parent frame and no title-bar text.
Parameters:
frame
public Filer(Frame frame, String title)
Constructs an Open or Save As dialog box with the specified parent frame and title-bar text.
Parameters:
frame
title
public Filer(Frame frame, String title, int mode)
Constructs a File Open or File Save dialog box with specified frame, title, and mode.
Parameters:
frame
title
mode
public String getDirectory() public void setDirectory(String dir)
Specifies the path and directory name selected in the dialog box.
public String getFile() public void setFile(String file)
Determines the selected file in the dialog box.
public FilenameFilter getFilenameFilter() public void setFilenameFilter(FilenameFilter filter)
For the Show Files Of Type drop-down list. Returns or sets the filter
for this dialog to the specified filter. FilenameFilter
is an interface. To set a filter for the Filer
dialog
box, you must create a class that implements FilenameFilter
.
This interface includes an accept()
method that returns
a boolean value indicating whether a particular
file meets the filtering specifications laid out in accept()
.
For example, accept()
might return true
if a file has this an .html extension.
public Frame getFrame() public void setFrame(Frame frame)
The parent frame of the dialog box.
public int getMode() public void setMode(int m)
Can be LOAD (for a File Open dialog box) or SAVE (for a File Save dialog box).
public String getTitle() public void setTitle(String title)
The title-bar text of the dialog box.
public boolean isVisible() public void setVisible(boolean visible)
Specifies whether the dialog box visible or not.
public void show()
Displays the dialog box using java.awt.Dialog.show()
.