|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.as400.ui.framework.java.FileChooserDialog
public class FileChooserDialog extends Object
This interface provides a simple mechanism for the user to choose a file to open or choose a file to save. A default start directory, default file, and multiple file selection is supported.
Restrictions:
| Modifier and Type | Field and Description |
|---|---|
static int |
CANCEL_OPTION
Return value if cancel is chosen. |
static int |
COMMIT_OPTION
Return value if commit (yes, ok) is chosen. |
static int |
DIRECTORIES_ONLY
Instruction to display only directories. |
static int |
FILES_AND_DIRECTORIES
Instruction to display both files and directories. |
static int |
FILES_ONLY
Instruction to display only files. |
| Constructor and Description |
|---|
FileChooserDialog()
Creates a FileChooserDialog pointing to the user's home directory. |
FileChooserDialog(File file)
Creates a FileChooserDialog using the given File as the path. |
FileChooserDialog(String currentDirectoryPath)
Creates a FileChooserDialog using the given path. |
| Modifier and Type | Method and Description |
|---|---|
void |
addFilter(String[] extensions,
String description)
Adds a file Filter to the FileChooserDialog Adds a file Filter to the FileChooserDialog. |
File |
getCurrentDirectory()
Returns the current directory. |
String |
getDialogTitle()
Gets the string that goes in the FileChooserDialog's titlebar. |
String[] |
getFilter()
Returns the currently selected file filter. |
File |
getSelectedFile()
Returns the selected file. |
File[] |
getSelectedFiles()
Returns a list of selected files if the filechooser is set to allow multi-selection. |
int |
getSelectionMode()
Returns the current file-selection mode. |
boolean |
isMultiSelectionEnabled()
Returns true if multiple files can be selected. |
void |
removeAcceptAllFilter()
Removes the Accept All filter (*.*) from this FileChooserDialog |
void |
setCurrentDirectory(File currentDirectory)
Sets the current directory. |
void |
setDialogTitle(String dialogTitle)
Sets the string that goes in the FileChooserDialog's titlebar. |
void |
setFilter(String[] extensions)
Sets the current file filter. |
void |
setMultiSelectionEnabled(boolean b)
Sets the filechooser to allow multiple file selections. |
void |
setSelectedFile(File file)
Sets the selected file. |
void |
setSelectedFiles(File[] files)
Sets the list of selected files if the filechooser is set to allow multi-selection. |
void |
setSelectionMode(int mode)
Sets the FileChooserDialog to allow the user to just select files, just select directories, or select both files and directories. |
int |
showCustomDialog(WindowManager parent,
String commitButtonText)
Brings up a FileChooserDialog with custom text on the CommitButton. |
int |
showOpenDialog(WindowManager parent)
Brings up an "Open" FileChooserDialog. |
int |
showSaveDialog(WindowManager parent)
Brings up a "Save" FileChooserDialog. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DIRECTORIES_ONLY
public static final int FILES_ONLY
public static final int FILES_AND_DIRECTORIES
public static final int COMMIT_OPTION
public static final int CANCEL_OPTION
| Constructor Detail |
|---|
public FileChooserDialog()
public FileChooserDialog(String currentDirectoryPath)
currentDirectoryPath - a String giving the path to a file or directorypublic FileChooserDialog(File file)
file - a File object specifying the path to a file
or directory| Method Detail |
|---|
public void setDialogTitle(String dialogTitle)
dialogTitle - The translatable String to be displayedgetDialogTitle()public String getDialogTitle()
setDialogTitle(java.lang.String)public void setSelectionMode(int mode)
dialogType - the type of dialog to be displayed:
FILES_ONLY, DIRECTORIES_ONLY, FILES_AND_DIRECTORIESgetSelectionMode()public int getSelectionMode()
setSelectionMode(int)public void setMultiSelectionEnabled(boolean b)
isMultiSelectionEnabled()public boolean isMultiSelectionEnabled()
setMultiSelectionEnabled(boolean)public void setSelectedFile(File file)
File - the selected filegetSelectedFile()public File getSelectedFile()
setSelectedFile(java.io.File)public void setSelectedFiles(File[] files)
files - An Array of files to be initially selctedpublic File[] getSelectedFiles()
public void setCurrentDirectory(File currentDirectory)
currentDirectory - the current directory to point togetCurrentDirectory()public File getCurrentDirectory()
setCurrentDirectory(java.io.File)public int showOpenDialog(WindowManager parent)
parent - the WindowManager that is the parent of this dialogpublic int showSaveDialog(WindowManager parent)
parent - the WindowManager that is the parent of this dialog
public int showCustomDialog(WindowManager parent,
String commitButtonText)
parent - the WindowManager that is the parent of this dialogapproveButtonText - the text of the ApproveButton
public void addFilter(String[] extensions,
String description)
Adds a file Filter to the FileChooserDialog. The last filter added will be the initially used filter.
extensions - An array of file extension to filter i.e. "txt", "doc"description - A translatable description of the filterpublic String[] getFilter()
setFilter(java.lang.String[]),
addFilter(java.lang.String[], java.lang.String)public void setFilter(String[] extensions)
extensions - the file extensions i.e. "txt" to filtergetFilter(),
addFilter(java.lang.String[], java.lang.String)public void removeAcceptAllFilter()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||