当前页面: 
在线文档首页 > 
JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档
Class java.awt.FileDialog - JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class java.awt.FileDialog
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Dialog
                                   |
                                   +----java.awt.FileDialog
  -  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.
    -  See Also:
    
-  show
   
  -   LOAD LOAD
-   This constant value indicates that the purpose of the file  
 dialog window is to locate a file from which to read.
  
-   SAVE SAVE
-   This constant value indicates that the purpose of the file  
 dialog window is to locate a file to which to write.
   
  -   FileDialog(Frame) FileDialog(Frame)
-   Creates a file dialog for loading a file.
  
-   FileDialog(Frame, String) FileDialog(Frame, String)
-   Creates a file dialog window with the specified title for loading 
 a file.
  
-   FileDialog(Frame, String, int) FileDialog(Frame, String, int)
-   Creates a file dialog window with the specified title for loading 
 or saving a file.
   
  -   addNotify() addNotify()
-   Creates the file dialog's peer.
  
-   getDirectory() getDirectory()
-   Gets the directory of this file dialog.
  
-   getFile() getFile()
-   Gets the selected file of this file dialog.
  
-   getFilenameFilter() getFilenameFilter()
-   Determines this file dialog's filename filter.
  
-   getMode() getMode()
-   Indicates whether this file dialog box is for loading from a file 
 or for saving to a file.
  
-   paramString() paramString()
-   Returns the parameter string representing the state of this file 
 dialog window.
  
-   setDirectory(String) setDirectory(String)
-   Sets the directory of this file dialog window to be the  
 specified directory.
  
-   setFile(String) setFile(String)
-   Sets the selected file for this file dialog window to be the 
 specified file.
  
-   setFilenameFilter(FilenameFilter) setFilenameFilter(FilenameFilter)
-   Sets the filename filter for this file dialog window to the 
 specified filter.
  
-   setMode(int) setMode(int)
-   Sets the mode of the file dialog.
   
 LOAD
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
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
FileDialog
 public FileDialog(Frame parent)
  -  Creates a file dialog for loading a file.  The title of the
 file dialog is initially empty.
   
- 
    -  Parameters:
    
-  parent - the owner of the dialog
  
 
 FileDialog
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.
   
- 
    -  Parameters:
    
-  parent - the owner of the dialog.
    -  title - the title of the dialog.
  
 
 FileDialog
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. If the value ofmodeisSAVE, 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.
    
-  See Also:
    
-  LOAD, SAVE
  
 
   
 addNotify
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
  
 
 getMode
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.SAVE.
-  See Also:
    
-  LOAD, SAVE, setMode
  
 
 setMode
setMode
 public void setMode(int mode)
  -  Sets the mode of the file dialog.
   
- 
    -  Parameters:
    
-  mode - the mode for this file dialog, either
                 FileDialog.LOADorFileDialog.SAVE.
-  Throws: IllegalArgumentException
    
-  if an illegal file
                 dialog mode is used.
    
-  See Also:
    
-  LOAD, SAVE, getMode
  
 
 getDirectory
getDirectory
 public String getDirectory()
  -  Gets the directory of this file dialog.
   
- 
    -  Returns:
    
-  the directory of this file dialog.
    
-  See Also:
    
-  setDirectory
  
 
 setDirectory
setDirectory
 public void setDirectory(String dir)
  -  Sets the directory of this file dialog window to be the  
 specified directory.
   
- 
    -  Parameters:
    
-  dir - the specific directory.
    
-  See Also:
    
-  getDirectory
  
 
 getFile
getFile
 public String getFile()
  -  Gets the selected file of this file dialog.
   
- 
    -  Returns:
    
-  the currently selected file of this file dialog window,
                or nullif none is selected.
-  See Also:
    
-  setFile
  
 
 setFile
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.
   
- 
    -  Parameters:
    
-  file - the file being set.
    
-  See Also:
    
-  getFile
  
 
 getFilenameFilter
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.
   
- 
    -  Returns:
    
-  this file dialog's filename filter.
    
-  See Also:
    
-  FilenameFilter, setFilenameFilter
  
 
 setFilenameFilter
setFilenameFilter
 public synchronized void setFilenameFilter(FilenameFilter filter)
  -  Sets the filename filter for this file dialog window to the 
 specified filter.
   
- 
    -  Parameters:
    
-  filter - the specified filter.
    
-  See Also:
    
-  FilenameFilter, getFilenameFilter
  
 
 paramString
paramString
 protected String paramString()
  -  Returns the parameter string representing the state of this file 
 dialog window. This string is useful for debugging.
   
- 
    -  Returns:
    
-  the parameter string of this file dialog window.
    
-  Overrides:
    
-  paramString in class Dialog
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems,  Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A.  All Rights Reserved.