public final class ChooseFile extends Object
An application must register its File chooser dialog box with this facility otherwise a standard JFileChooser is used.
Modifier and Type | Class and Description |
---|---|
static interface |
ChooseFile.FileChooser
This interface must be implemented by the application if it has an
advanced file chooser dialog box.
|
static class |
ChooseFile.FileChooserImpl
Default implementation of
ChooseFile.FileChooser : uses the standard
JFileChooser. |
Modifier and Type | Field and Description |
---|---|
static ChooseFile.FileChooserImpl |
DEFAULT_CHOOSER
Ready-to-use instance of
ChooseFile.FileChooserImpl . |
Constructor and Description |
---|
ChooseFile() |
Modifier and Type | Method and Description |
---|---|
static File |
chooseFile(Component parentComponent,
File templateFile,
boolean dirMode,
boolean saveMode,
ChooseFileOptions options)
Low-level utility: selects a file according to specified arguments.
|
static File |
chooseOpenDirectory(Component parentComponent,
File template,
ChooseFileOptions options)
Convenience method: equivalent to
getFileChooser().chooseOpenDirectory(parentComponent,template,options) . |
static File |
chooseOpenFile(Component parentComponent,
File template,
ChooseFileOptions options)
Convenience method: equivalent to
getFileChooser().chooseOpenFile(parentComponent, template, options) . |
static File |
chooseSaveDirectory(Component parentComponent,
File template,
ChooseFileOptions options)
Convenience method: equivalent to
getFileChooser().chooseSaveDirectory(parentComponent,template,options) . |
static File |
chooseSaveFile(Component parentComponent,
File template,
ChooseFileOptions options)
Convenience method: equivalent to
getFileChooser().chooseSaveFile(parentComponent, template, options) . |
static String |
getChooserTitle(boolean dirMode,
boolean saveMode)
Low-level helper: returns a localized title for a file chooser
dialog box working using specified modes.
|
static ChooseFile.FileChooser |
getFileChooser()
Returns the object implementing an File chooser dialog box.
|
static void |
setFileChooser(ChooseFile.FileChooser fileChooser)
Specifies the object implementing an File chooser dialog box.
|
public static ChooseFile.FileChooserImpl DEFAULT_CHOOSER
ChooseFile.FileChooserImpl
.public static void setFileChooser(ChooseFile.FileChooser fileChooser)
public static ChooseFile.FileChooser getFileChooser()
public static File chooseOpenFile(Component parentComponent, File template, ChooseFileOptions options)
getFileChooser().chooseOpenFile(parentComponent, template, options)
.public static File chooseSaveFile(Component parentComponent, File template, ChooseFileOptions options)
getFileChooser().chooseSaveFile(parentComponent, template, options)
.public static File chooseOpenDirectory(Component parentComponent, File template, ChooseFileOptions options)
getFileChooser().chooseOpenDirectory(parentComponent,template,options)
.public static File chooseSaveDirectory(Component parentComponent, File template, ChooseFileOptions options)
getFileChooser().chooseSaveDirectory(parentComponent,template,options)
.public static File chooseFile(Component parentComponent, File templateFile, boolean dirMode, boolean saveMode, ChooseFileOptions options)
parentComponent
- used to find a parent for the dialog boxtemplateFile
- used as a template for the file to be selected.
May be null
.dirMode
- if true
, selected file must be directorysaveMode
- if true
, returned file must be a save fileoptions
- dialog box options. May be null
.null
if user has canceled
the selection.public static String getChooserTitle(boolean dirMode, boolean saveMode)