
 |
Chapter 19 java.awt Reference |
 |
FileDialog
Name
FileDialog
The FileDialog class provides
file selection capabilities for opening or saving files. Because FileDialog
is a subclass of Dialog, a
FileDialog is always associated
with a Frame and is hidden
by default. FileDialogs are
always modal (i.e., they always attract all user input). In addition, FileDialogs
have a load/save mode; the LOAD
mode is for selecting files for an application to load, SAVE
is for selecting a filename to save.
public class java.awt.FileDialog
extends java.awt.Dialog {
// Constants
public final static int LOAD;
public final static int SAVE;
// Constructors
public FileDialog (Frame parent);
public FileDialog (Frame parent, String title);
public FileDialog (Frame parent, String title, int mode);
// Instance Methods
public void addNotify();
public String getDirectory();
public String getFile();
public FilenameFilter getFilenameFilter();
public int getMode();
public synchronized void setDirectory (String directory);
public synchronized void setFile (String file);
public synchronized void setFilenameFilter (FilenameFilter filter);
public void setMode(int mode);
// Protected Instance Methods
protected String paramString();
}
Constant to specify the FileDialog's
load mode.
Constant to specify the FileDialog's
save mode.
- Parameters
-
- parent
-
Frame that
is to act as parent of FileDialog.
- Description
-
Constructs a FileDialog object
in LOAD mode.
- Parameters
-
- parent
-
Frame that
is to act as parent of FileDialog.
- title
-
Title to use for FileDialog.
- Description
-
Constructs a FileDialog object
in LOAD mode.
- Parameters
-
- parent
-
Frame that
is to act as parent of Dialog.
- title
-
Title to use for FileDialog.
- mode
-
The constant LOAD
or SAVE, specifying the dialog's
mode.
- Description
-
Constructs a FileDialog object
in the given mode.
- Overrides
-
Dialog.addNotify()
- Description
-
Creates FileDialog's
peer for the native platform.
- Returns
-
The current directory for the FileDialog.
- Returns
-
The current file selected by the FileDialog.
- Returns
-
The current filename filter for the FileDialog.
- Returns
-
The current mode of the FileDialog.
- Parameters
-
- directory
-
Directory to be
displayed by the FileDialog.
- Description
-
Changes the directory displayed in the FileDialog.
- Parameters
-
- file
-
Initial file string for FileDialog.
- Description
-
Change the default file selected by the FileDialog.
- Parameters
-
- filter
-
Initial filter for FileDialog.
- Description
-
Changes the current filename filter of the FileDialog.
- Parameters
-
- mode
-
The constant LOAD
or SAVE, specifying the dialog's
mode.
- Description
-
Change the mode of the file dialog.
- Returns
-
String with current settings of FileDialog.
- Overrides
-
Dialog.paramString()
- Description
-
Helper method for toString()
to generate string of current settings.
Dialog, FilenameFilter,
String
|
|