Package org.harctoolbox.guicomponents
Class SelectFile
java.lang.Object
org.harctoolbox.guicomponents.SelectFile
This class packs a number of file selectors.
-
Method Summary
Modifier and TypeMethodDescriptionstatic final void
restoreFromString
(String string) static final String
static File
selectFile
(Component parent, String title, String defaultdir, boolean save, boolean showHiddenFiles, int mode, String[]... filetypes) Encapsulates a file selector.static File
selectFile
(Component parent, String title, String defaultdir, boolean save, boolean showHiddenFiles, int mode, String fileTypeDesc, String extension) static File
selectFile
(Component parent, String title, String defaultdir, boolean save, boolean showHiddenFiles, String fileTypeDesc, String extension) Version of the file selector with exactly one file extension.
-
Method Details
-
saveString
-
restoreFromString
-
selectFile
public static File selectFile(Component parent, String title, String defaultdir, boolean save, boolean showHiddenFiles, String fileTypeDesc, String extension) Version of the file selector with exactly one file extension.- Parameters:
parent
-title
-save
-defaultdir
-showHiddenFiles
-extension
-fileTypeDesc
-- Returns:
- Selected File, or null.
-
selectFile
-
selectFile
public static File selectFile(Component parent, String title, String defaultdir, boolean save, boolean showHiddenFiles, int mode, String[]... filetypes) Encapsulates a file selector. The finally selected direcory will be remembered, and used as initial directory for subsequent invocations with the same title.- Parameters:
parent
- Component, to which the popup will be positioned.title
- Title of the popup. Also identifies the file selector.save
- True iff the file is to be written.defaultdir
- Default direcory if not stored in the class' static memory.showHiddenFiles
- If true show also "hidden files".mode
- the type of files to be displayed: JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES.filetypes
- Variable number of file extensions, as pair of strings.- Returns:
- Selected File, or null.
-