|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Dialog | +--java.awt.FileDialog
The FileDialog
class displays a dialog window
from which the user can select a file.
Since it is a modal dialog, when the application calls
its show
method to display the dialog,
it blocks the rest of the application until the user has
chosen a file.
Window.show()
, Serialized FormField Summary | |
static int |
LOAD
This constant value indicates that the purpose of the file dialog window is to locate a file from which to read. |
static int |
SAVE
This constant value indicates that the purpose of the file dialog window is to locate a file to which to write. |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
FileDialog(Frame parent)
Creates a file dialog for loading a file. |
|
FileDialog(Frame parent,
String title)
Creates a file dialog window with the specified title for loading a file. |
|
FileDialog(Frame parent,
String title,
int mode)
Creates a file dialog window with the specified title for loading or saving a file. |
Method Summary | |
void |
addNotify()
Creates the file dialog's peer. |
String |
getDirectory()
Gets the directory of this file dialog. |
String |
getFile()
Gets the selected file of this file dialog. |
FilenameFilter |
getFilenameFilter()
Determines this file dialog's filename filter. |
int |
getMode()
Indicates whether this file dialog box is for loading from a file or for saving to a file. |
protected String |
paramString()
Returns the parameter string representing the state of this file dialog window. |
void |
setDirectory(String dir)
Sets the directory of this file dialog window to be the specified directory. |
void |
setFile(String file)
Sets the selected file for this file dialog window to be the specified file. |
void |
setFilenameFilter(FilenameFilter filter)
Sets the filename filter for this file dialog window to the specified filter. |
void |
setMode(int mode)
Sets the mode of the file dialog. |
Methods inherited from class java.awt.Dialog |
getTitle,
isModal,
isResizable,
setModal,
setResizable,
setTitle,
show |
Methods inherited from class java.awt.Window |
addWindowListener,
applyResourceBundle,
applyResourceBundle,
dispose,
finalize,
getFocusOwner,
getInputContext,
getLocale,
getOwnedWindows,
getOwner,
getToolkit,
getWarningString,
isShowing,
pack,
postEvent,
processEvent,
processWindowEvent,
removeWindowListener,
toBack,
toFront |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setFont,
setLayout,
update,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int LOAD
public static final int SAVE
Constructor Detail |
public FileDialog(Frame parent)
parent
- the owner of the dialogpublic FileDialog(Frame parent, String title)
parent
- the owner of the dialog.title
- the title of the dialog.public FileDialog(Frame parent, String title, int mode)
If the value of mode
is LOAD
, then the
file dialog is finding a file to read. If the value of
mode
is SAVE
, the file dialog is finding
a place to write a file.
parent
- the owner of the dialog.title
- the title of the dialog.mode
- the mode of the dialog.LOAD
,
SAVE
Method Detail |
public void addNotify()
public int getMode()
FileDialog.LOAD
or
FileDialog.SAVE
.LOAD
,
SAVE
,
setMode(int)
public void setMode(int mode)
mode
- the mode for this file dialog, either
FileDialog.LOAD
or
FileDialog.SAVE
.LOAD
,
SAVE
,
getMode()
public String getDirectory()
setDirectory(java.lang.String)
public void setDirectory(String dir)
null
or an
invalid directory implies an implementation-defined default.
This default will not be realized, however, until the user
has selected a file. Until this point, getDirectory()
will return the value passed into this method.
Specifying "" as the directory is exactly equivalent to
specifying null
as the directory.
dir
- the specific directory.getDirectory()
public String getFile()
null
if none is selected.setFile(java.lang.String)
public void setFile(String file)
Specifying "" as
the file is exactly equivalent to specifying null
as the file.
file
- the file being set.getFile()
public FilenameFilter getFilenameFilter()
FilenameFilter
,
setFilenameFilter(java.io.FilenameFilter)
public void setFilenameFilter(FilenameFilter filter)
filter
- the specified filter.FilenameFilter
,
getFilenameFilter()
protected String paramString()
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |