Class FileChooser
java.lang.Object
VASSAL.tools.filechooser.FileChooser
FileChooser provides a wrapper for
JFileChooser
and
FileDialog
, selecting whichever is preferred on the
user's OS. FileChooser
's methods mirror those of
JFileChooser
.- Author:
- Joel Uckelman
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
protected Component
protected DirectoryConfigurer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
addChoosableFileFilter
(FileFilter filter) static FileChooser
createFileChooser
(Component parent) static FileChooser
createFileChooser
(Component parent, DirectoryConfigurer prefs) static FileChooser
createFileChooser
(Component parent, DirectoryConfigurer prefs, int mode) Creates a FileChooser appropriate for the user's OS.abstract File
abstract String
abstract FileFilter
abstract File
abstract boolean
removeChoosableFileFilter
(FileFilter filter) abstract void
abstract void
void
Selects filename.vsav if filename.foo is selected.abstract void
setCurrentDirectory
(File dir) abstract void
setDialogTitle
(String title) abstract void
setFileFilter
(FileFilter filter) abstract void
setSelectedFile
(File file) int
Same asshowOpenDialog(Component)
, but uses the parent set on creation of this FileDialog.abstract int
showOpenDialog
(Component parent) int
Same asshowSaveDialog(Component)
, but uses the parent set on creation of this FileDialog.abstract int
showSaveDialog
(Component parent) protected void
-
Field Details
-
parent
-
prefs
-
APPROVE_OPTION
public static final int APPROVE_OPTION- See Also:
-
CANCEL_OPTION
public static final int CANCEL_OPTION- See Also:
-
ERROR_OPTION
public static final int ERROR_OPTION- See Also:
-
FILES_ONLY
public static final int FILES_ONLY- See Also:
-
DIRECTORIES_ONLY
public static final int DIRECTORIES_ONLY- See Also:
-
-
Constructor Details
-
FileChooser
-
-
Method Details
-
createFileChooser
-
createFileChooser
-
createFileChooser
Creates a FileChooser appropriate for the user's OS.- Parameters:
parent
- The Component over which the FileChooser should appear.prefs
- A FileConfigure that stores the preferred starting directory of the FileChooser in preferences
-
getCurrentDirectory
-
setCurrentDirectory
-
rescanCurrentDirectory
public abstract void rescanCurrentDirectory() -
getSelectedFile
-
setSelectedFile
-
getDialogTitle
-
setDialogTitle
-
showOpenDialog
-
showSaveDialog
-
getFileFilter
-
setFileFilter
-
addChoosableFileFilter
-
removeChoosableFileFilter
-
resetChoosableFileFilters
public abstract void resetChoosableFileFilters() -
selectDotSavFile
public void selectDotSavFile()Selects filename.vsav if filename.foo is selected. -
showOpenDialog
public int showOpenDialog()Same asshowOpenDialog(Component)
, but uses the parent set on creation of this FileDialog. -
showSaveDialog
public int showSaveDialog()Same asshowSaveDialog(Component)
, but uses the parent set on creation of this FileDialog. -
updateDirectoryPreference
protected void updateDirectoryPreference()
-