| JavaTM 2 Platform Std. Ed. v1.4.2 
 
java.awt
Class FileDialog
java.lang.Object
   java.awt.Component  java.awt.Container  java.awt.Window  java.awt.Dialog  java.awt.FileDialog 
All Implemented Interfaces: Accessible, ImageObserver, MenuContainer, Serializable 
 
public class FileDialogextends Dialog 
The FileDialogclass displays a dialog window
 from which the user can select a file. 
 Since it is a modal dialog, when the application calls
 its showmethod to display the dialog,
 it blocks the rest of the application until the user has
 chosen a file. 
 
 
Since:JDK1.0See Also:Window.show(), 
Serialized Form 
 
 
| Field Summary |  
| static int | LOADThis constant value indicates that the purpose of the file
 dialog window is to locate a file from which to read.
 |  
| static int | SAVEThis constant value indicates that the purpose of the file
 dialog window is to locate a file to which to write.
 |  
| 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 a string representing the state of this
 FileDialogwindow. |  
|  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 |  
| dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show |  
| Methods inherited from class java.awt.Window |  
| addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront |  
| Methods inherited from class java.awt.Container |  
| add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, 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, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |  
 
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.
 
See Also:Constant Field Values 
 
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.
 
See Also:Constant Field Values 
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 dialogSince:JDK1.1 
 
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 dialogtitle- 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 modeisLOAD, then the
 file dialog is finding a file to read, and the files shown are those
 in the current directory.   If the value ofmodeisSAVE, the file dialog is finding
 a place to write a file. 
Parameters:parent- the owner of the dialogtitle- the title of the dialogmode- the mode of the dialog; eitherFileDialog.LOADorFileDialog.SAVEThrows:
IllegalArgumentException- if an illegal file
                 dialog mode is suppliedSee Also:LOAD,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:addNotifyin classDialog
See Also:Component.isDisplayable(),Container.removeNotify() 
 
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.LOADorFileDialog.SAVESee Also:LOAD,SAVE,setMode(int) 
 
setMode
public void setMode(int mode) 
Sets the mode of the file dialog.  If modeis not
 a legal value, an exception will be thrown andmodewill not be set.
 
Parameters:mode- the mode for this file dialog, eitherFileDialog.LOADorFileDialog.SAVEThrows:
IllegalArgumentException- if an illegal file
                 dialog mode is suppliedSince:JDK1.1See Also:LOAD,SAVE,getMode() 
 
getDirectory
public String getDirectory() 
Gets the directory of this file dialog.
 
Returns:the (potentially nullor invalid)
		directory of thisFileDialogSee Also:setDirectory(java.lang.String) 
 
setDirectory
public void setDirectory(String dir) 
Sets the directory of this file dialog window to be the
 specified directory. Specifying a nullor 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 nullas the directory. 
 
Parameters:dir- the specified directorySee Also:getDirectory() 
 
getFile
public String getFile() 
Gets the selected file of this file dialog.  If the user
 selected CANCEL, the returned file isnull.
 
Returns:the currently selected file of this file dialog window,
                or nullif none is selectedSee Also:setFile(java.lang.String) 
 
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
 nullas the file. 
 
Parameters:file- the file being setSee Also:getFile() 
 
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 Windows 95, 98, or NT 4.0.
 
Returns:this file dialog's filename filterSee Also:FilenameFilter,setFilenameFilter(java.io.FilenameFilter) 
 
setFilenameFilter
public 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 Windows 95, 98, or NT 4.0.
 
Parameters:filter- the specified filterSee Also:FilenameFilter,getFilenameFilter() 
 
paramString
protected String paramString() 
Returns a string representing the state of this FileDialogwindow. 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 benull.
 
Overrides:paramStringin classDialog
Returns:the parameter string of this file dialog window 
 Copyright 2003 Sun Microsystems, Inc. All rights reserved |