This documentation differs from the official API.
Jadeite adds
extra features to the API including:
variable font sizes,
constructions examples,
placeholders for classes and methods, and auto-generated “See Also” links.
Additionally it
is missing some items found in standard Javadoc documentation, including:
generics type information,
“Deprecated” tags and comments,
“See Also” links,
along with other minor differences.
Please send any questions or feedback to
bam@cs.cmu.edu.
java.awt
class FileDialog
- All Implemented Interfaces:
- MenuContainer, ImageObserver, Serializable, Accessible
public class FileDialog
extends Dialog
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.
Field 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. |
Constructor Summary |
Creates a file dialog for loading a file.
|
Creates a file dialog window with the specified title for loading
a file.
|
Creates a file dialog window with the specified title for loading
or saving a file.
|
Creates a file dialog for loading a file.
|
Creates a file dialog window with the specified title for loading
a file.
|
Creates a file dialog window with the specified title for loading
or saving a file.
|
Method Summary |
void |
Creates the file dialog's peer.
|
String |
Gets the directory of this file dialog.
|
String |
Gets the selected file of this file dialog.
|
FilenameFilter |
Determines this file dialog's filename filter.
|
int |
Indicates whether this file dialog box is for loading from a file
or for saving to a file.
|
protected String |
Returns a string representing the state of this FileDialog
window.
|
void |
Sets the directory of this file dialog window to be the
specified directory.
|
void |
Sets the selected file for this file dialog window to be the
specified file.
|
void |
Sets the filename filter for this file dialog window to the
specified filter.
|
void |
Sets the mode of the file dialog.
|
Methods inherited from class java.awt.Dialog |
addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack |
Methods inherited from class java.awt.Window |
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getAccessibleContext, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOAD
public static final int LOAD
-
This constant value indicates that the purpose of the file
dialog window is to locate a file from which to read.
SAVE
public static final int SAVE
-
This constant value indicates that the purpose of the file
dialog window is to locate a file to which to write.
FileDialog
public FileDialog(Dialog parent)
-
Creates a file dialog for loading a file. The title of the
file dialog is initially empty. This is a convenience method for
FileDialog(parent, "", LOAD)
.
- Parameters:
parent
- the owner of the dialog
FileDialog
public FileDialog(Dialog parent,
String title)
-
Creates a file dialog window with the specified title for loading
a file. The files shown are those in the current directory.
This is a convenience method for
FileDialog(parent, title, LOAD)
.
- Parameters:
parent
- the owner of the dialog
title
- the title of the dialog; a null
value
will be accepted without causing a
NullPointerException
to be thrown
FileDialog
public FileDialog(Dialog parent,
String title,
int mode)
-
Creates a file dialog window with the specified title for loading
or saving a file.
If the value of mode
is LOAD
, then the
file dialog is finding a file to read, and the files shown are those
in the current directory. If the value of
mode
is SAVE
, the file dialog is finding
a place to write a file.
- Parameters:
parent
- the owner of the dialog
title
- the title of the dialog; a null
value
will be accepted without causing a
NullPointerException
to be thrown
mode
- the mode of the dialog; either
FileDialog.LOAD
or FileDialog.SAVE
FileDialog
public FileDialog(Frame parent)
-
Creates a file dialog for loading a file. The title of the
file dialog is initially empty. This is a convenience method for
FileDialog(parent, "", LOAD)
.
- Parameters:
parent
- the owner of the dialog
FileDialog
public FileDialog(Frame parent,
String title)
-
Creates a file dialog window with the specified title for loading
a file. The files shown are those in the current directory.
This is a convenience method for
FileDialog(parent, title, LOAD)
.
- Parameters:
parent
- the owner of the dialog
title
- the title of the dialog
FileDialog
public FileDialog(Frame parent,
String title,
int mode)
-
Creates a file dialog window with the specified title for loading
or saving a file.
If the value of mode
is LOAD
, then the
file dialog is finding a file to read, and the files shown are those
in the current directory. If the value of
mode
is SAVE
, the file dialog is finding
a place to write a file.
- Parameters:
parent
- the owner of the dialog
title
- the title of the dialog
mode
- the mode of the dialog; either
FileDialog.LOAD
or FileDialog.SAVE
addNotify
public void addNotify()
-
Creates the file dialog's peer. The peer allows us to change the look
of the file dialog without changing its functionality.
- Overrides:
addNotify
in class Dialog
getDirectory
public String getDirectory()
-
Gets the directory of this file dialog.
- Returns:
- the (potentially
null
or invalid)
directory of this FileDialog
getFile
public String getFile()
-
Gets the selected file of this file dialog. If the user
selected
CANCEL
, the returned file is null
.
- Returns:
- the currently selected file of this file dialog window,
or
null
if none is selected
getFilenameFilter
public FilenameFilter getFilenameFilter()
-
Determines this file dialog's filename filter. A filename filter
allows the user to specify which files appear in the file dialog
window. Filename filters do not function in Sun's reference
implementation for Microsoft Windows.
- Returns:
- this file dialog's filename filter
getMode
public int getMode()
-
Indicates whether this file dialog box is for loading from a file
or for saving to a file.
- Returns:
- the mode of this file dialog window, either
FileDialog.LOAD
or
FileDialog.SAVE
paramString
protected String paramString()
-
Returns a string representing the state of this
FileDialog
window. This method is intended to be used only for debugging purposes,
and the content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null
.
- Overrides:
paramString
in class Dialog
- Returns:
- the parameter string of this file dialog window
setDirectory
public void setDirectory(String dir)
-
Sets the directory of this file dialog window to be the
specified directory. Specifying a
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.
- Parameters:
dir
- the specified directory
setFile
public void setFile(String file)
-
Sets the selected file for this file dialog window to be the
specified file. This file becomes the default file if it is set
before the file dialog window is first shown.
Specifying "" as the file is exactly equivalent to specifying
null
as the file.
- Parameters:
file
- the file being set
setFilenameFilter
public synchronized void setFilenameFilter(FilenameFilter filter)
-
Sets the filename filter for this file dialog window to the
specified filter.
Filename filters do not function in Sun's reference
implementation for Microsoft Windows.
- Parameters:
filter
- the specified filter
setMode
public void setMode(int mode)
-
Sets the mode of the file dialog. If
mode
is not
a legal value, an exception will be thrown and mode
will not be set.
- Parameters:
mode
- the mode for this file dialog, either
FileDialog.LOAD
or
FileDialog.SAVE
This documentation differs from the official API.
Jadeite adds
extra features to the API including:
variable font sizes,
constructions examples,
placeholders for classes and methods, and auto-generated “See Also” links.
Additionally it
is missing some items found in standard Javadoc documentation, including:
generics type information,
“Deprecated” tags and comments,
“See Also” links,
along with other minor differences.
Please send any questions or feedback to
bam@cs.cmu.edu.
This page displays the
Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
The official Sun™ documentation can be found here at
http://java.sun.com/javase/6/docs/api/.