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 intAPPROVE_OPTIONstatic intCANCEL_OPTIONstatic intDIRECTORIES_ONLYstatic intERROR_OPTIONstatic intFILES_ONLYprotected Componentparentprotected DirectoryConfigurerprefs -
Constructor Summary
Constructors Modifier Constructor Description protectedFileChooser(Component parent, DirectoryConfigurer pref) -
Method Summary
Modifier and Type Method Description abstract voidaddChoosableFileFilter(FileFilter filter)static FileChoosercreateFileChooser(Component parent)static FileChoosercreateFileChooser(Component parent, DirectoryConfigurer prefs)static FileChoosercreateFileChooser(Component parent, DirectoryConfigurer prefs, int mode)Creates a FileChooser appropriate for the user's OS.abstract FilegetCurrentDirectory()abstract StringgetDialogTitle()abstract FileFiltergetFileFilter()abstract FilegetSelectedFile()abstract booleanremoveChoosableFileFilter(FileFilter filter)abstract voidrescanCurrentDirectory()abstract voidresetChoosableFileFilters()voidselectDotSavFile()Selects filename.sav if filename.foo is selected.abstract voidsetCurrentDirectory(File dir)abstract voidsetDialogTitle(String title)abstract voidsetFileFilter(FileFilter filter)abstract voidsetSelectedFile(File file)intshowOpenDialog()Same asshowOpenDialog(Component), but uses the parent set on creation of this FileDialog.abstract intshowOpenDialog(Component parent)intshowSaveDialog()Same asshowSaveDialog(Component), but uses the parent set on creation of this FileDialog.abstract intshowSaveDialog(Component parent)protected voidupdateDirectoryPreference()
-
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()
-