John W. Campbell
This class provides a file chooser dialogue window object with basic 'Open'
or 'Save' functions. If an incorrect filename is given when opening a file, the
user is given choices of cancelling the request or trying another file name.
When saving a file, the user will have the opportunity to overwrite a file
or to choose a new file name if the requested output file already exists.
The object is a sub-class of the Java JFileChooser object.
Class, fields, constructor and methods:
Class Details
Accessible Fields
Constructor
Method
- Package:
- Jdl.JdlLib;
- Class name:
- JdlFileChooser
- Class definition:
- public class JdlFileChooser
- Extends:
- JFileChooser
- Implements:
- none
- Actions:
- none
The following accessible fields have been defined:
- public final static int OPEN_DIALOG
- Open file for input flag.
- public final static int SAVE_DIALOG
- Open file to save flag.
- public final static int DEFAULT_DIR
- Default directory flag.
- public final static int CURRENT_DIR
- Current directory flag.
- public final static int HOME_DIR
- Home directory flag.
- final static long serialVersionUID
A single constructor is available.
Constructor:
Standard constructor
Constructs a JdlFileChooser with the required resources.
- Constructor Definition:
- public JdlFileChooser(Component parent, String title, int idir, int type)
- Parameters List:
- parent
- The parent component for the file chooser dialogue window.
- title
- A title for the file chooser dialogue window.
- idir
- The starting directory option which may be the user's
default directory DEFAULT_DIR (operating system dependent),
the current directory CURRENT_DIR or the home directory HOME_DIR.
- type
- The required type which may be OPEN_DIALOG to open an input file
or SAVE_DIALOG to save (write) an output file.
This section contains methods a single method to choose an input or
output file.
Method:
Choose file - chooseFile
This method requests the choice of a file name for either an input file
or output (save) file depending on the type requested when the object
was constructed. A brief description of the required file type and the
required file extension are given.
- Method Definition:
- public File chooseFile(String filename, String ext, String description)
- Parameters List:
- filename
- An initial/default file name for the selection.
- ext
- The required file name extension.
- description
- A brief description of the required file type for display
in the dialogue.
- Method Return:
-
A File object for the chosen file (null if the input was cancelled)
⇑ Up 2
⇑ Up 1
⇑ Top of this