J2EEOnlineJ2EE 





File Dialogs  «Prev  Next»
Lesson 2 Choosing files with file dialog boxes
Objective Investigate the steps necessary to use the FileDialog class.
The java.awt.FileDialog class is a subclass of java.awt.Dialog used for choosing a file to open or save. This class uses the host platform's standard Open and Save file dialog boxes.
choosing Files with fileDialog boxes
You will not add components to a file dialog box or worry about how to handle user interaction. You will just retrieve the result, which will be the name and directory of a file.
Since an applet can't rely on having access to the file system, file dialog boxes are primarily useful in applications.
There are four steps to using a FileDialog object:


  1. Create the FileDialog object.
  2. Point the FileDialog at a default directory or file (optional).
  3. Make the FileDialog visible.
  4. Get the directory name and filename of the chosen file.
we will explore each of these steps in the next four lessons.