Package VASSAL.tools.filechooser
Class FileChooser
java.lang.Object
VASSAL.tools.filechooser.FileChooser
public abstract class FileChooser extends Object
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
Fields Modifier and Type Field Description static int
APPROVE_OPTION
static int
CANCEL_OPTION
static int
DIRECTORIES_ONLY
static int
ERROR_OPTION
static int
FILES_ONLY
protected Component
parent
protected DirectoryConfigurer
prefs
-
Constructor Summary
Constructors Modifier Constructor Description protected
FileChooser(Component parent, DirectoryConfigurer pref)
-
Method Summary
Modifier and Type Method Description abstract 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
getCurrentDirectory()
abstract String
getDialogTitle()
abstract FileFilter
getFileFilter()
abstract File
getSelectedFile()
abstract boolean
removeChoosableFileFilter(FileFilter filter)
abstract void
rescanCurrentDirectory()
abstract void
resetChoosableFileFilters()
void
selectDotSavFile()
Selects filename.sav 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
showOpenDialog()
Same asshowOpenDialog(Component)
, but uses the parent set on creation of this FileDialog.abstract int
showOpenDialog(Component parent)
int
showSaveDialog()
Same asshowSaveDialog(Component)
, but uses the parent set on creation of this FileDialog.abstract int
showSaveDialog(Component parent)
protected void
updateDirectoryPreference()
-
Field Details
-
parent
-
prefs
-
APPROVE_OPTION
public static final int APPROVE_OPTION- See Also:
- Constant Field Values
-
CANCEL_OPTION
public static final int CANCEL_OPTION- See Also:
- Constant Field Values
-
ERROR_OPTION
public static final int ERROR_OPTION- See Also:
- Constant Field Values
-
FILES_ONLY
public static final int FILES_ONLY- See Also:
- Constant Field Values
-
DIRECTORIES_ONLY
public static final int DIRECTORIES_ONLY- See Also:
- Constant Field Values
-
-
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.sav 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()
-