java.awt

Class FileDialog

public class FileDialog extends Dialog implements Serializable

This class implements a file selection dialog box widget.
Field Summary
static intLOAD
Indicates that the purpose of the dialog is for opening a file.
static intSAVE
Indicates that the purpose of the dialog is for saving a file.
Constructor Summary
FileDialog(Dialog parent)
Initializes a new instance of FileDialog with the specified parent.
FileDialog(Dialog parent, String title)
Initialized a new instance of FileDialog with the specified parent and title.
FileDialog(Dialog parent, String title, int mode)
Initialized a new instance of FileDialog with the specified parent, title, and mode.
FileDialog(Frame parent)
Initializes a new instance of FileDialog with the specified parent.
FileDialog(Frame parent, String title)
Initialized a new instance of FileDialog with the specified parent and title.
FileDialog(Frame parent, String title, int mode)
Initialized a new instance of FileDialog with the specified parent, title, and mode.
Method Summary
voidaddNotify()
Creates the native peer for this file dialog box.
StringgetDirectory()
Returns the directory for this file dialog.
StringgetFile()
Returns the file that is selected in this dialog.
FilenameFiltergetFilenameFilter()
Returns the filename filter being used by this dialog.
intgetMode()
Returns the mode of this dialog, either LOAD or SAVE.
protected StringparamString()
Returns a debugging string for this object.
voidsetDirectory(String dir)
Sets the directory for this file dialog.
voidsetFile(String file)
Sets the selected file for this dialog.
voidsetFilenameFilter(FilenameFilter filter)
Sets the filename filter used by this dialog.
voidsetMode(int mode)
Sets the mode of this dialog to either LOAD or SAVE.

Field Detail

LOAD

public static final int LOAD
Indicates that the purpose of the dialog is for opening a file.

SAVE

public static final int SAVE
Indicates that the purpose of the dialog is for saving a file.

Constructor Detail

FileDialog

public FileDialog(Dialog parent)
Initializes a new instance of FileDialog with the specified parent. This dialog will have no title and will be for loading a file.

Parameters: parent The parent dialog for this.

Since: 1.5

FileDialog

public FileDialog(Dialog parent, String title)
Initialized a new instance of FileDialog with the specified parent and title. This dialog will be for opening a file.

Parameters: parent The parent dialog for this. title The title for this dialog.

Since: 1.5

FileDialog

public FileDialog(Dialog parent, String title, int mode)
Initialized a new instance of FileDialog with the specified parent, title, and mode.

Parameters: parent The parent dialog for this. title The title for this dialog. mode The mode of the dialog, either LOAD or SAVE.

Throws: IllegalArgumentException - if illegal mode, if GraphicsEnvironment.isHeadless or if parent is null.

Since: 1.5

FileDialog

public FileDialog(Frame parent)
Initializes a new instance of FileDialog with the specified parent. This dialog will have no title and will be for loading a file.

Parameters: parent The parent frame for this dialog.

FileDialog

public FileDialog(Frame parent, String title)
Initialized a new instance of FileDialog with the specified parent and title. This dialog will be for opening a file.

Parameters: parent The parent frame for this dialog. title The title for this dialog.

FileDialog

public FileDialog(Frame parent, String title, int mode)
Initialized a new instance of FileDialog with the specified parent, title, and mode.

Parameters: parent The parent frame for this dialog. title The title for this dialog. mode The mode of the dialog, either LOAD or SAVE.

Throws: IllegalArgumentException If an illegal file dialog mode is supplied.

Method Detail

addNotify

public void addNotify()
Creates the native peer for this file dialog box.

getDirectory

public String getDirectory()
Returns the directory for this file dialog.

Returns: The directory for this file dialog.

getFile

public String getFile()
Returns the file that is selected in this dialog.

Returns: The file that is selected in this dialog.

getFilenameFilter

public FilenameFilter getFilenameFilter()
Returns the filename filter being used by this dialog.

Returns: The filename filter being used by this dialog.

getMode

public int getMode()
Returns the mode of this dialog, either LOAD or SAVE.

Returns: The mode of this dialog.

paramString

protected String paramString()
Returns a debugging string for this object.

Returns: A debugging string for this object.

setDirectory

public void setDirectory(String dir)
Sets the directory for this file dialog.

Parameters: dir The new directory for this file dialog.

setFile

public void setFile(String file)
Sets the selected file for this dialog.

Parameters: file The selected file for this dialog.

setFilenameFilter

public void setFilenameFilter(FilenameFilter filter)
Sets the filename filter used by this dialog.

Parameters: filter The new filename filter for this file dialog box.

setMode

public void setMode(int mode)
Sets the mode of this dialog to either LOAD or SAVE. This method is only effective before the native peer is created.

Parameters: mode The new mode of this file dialog.

Throws: IllegalArgumentException If an illegal file dialog mode is supplied.