public class FileChooserUtil extends Object
Constructor and Description |
---|
FileChooserUtil() |
Modifier and Type | Method and Description |
---|---|
static FileAndFileFilter |
getUserSelectedFile(Component parent,
String[] fileEndings,
String[] fileFormatDescriptions,
String aDialogTitle,
String lastSelectedFolder,
String aSuggestedFileName,
boolean openDialog,
boolean formatSelectedByUser,
boolean showAllFilesOption,
int defaultFilterIndex)
Returns the file selected by the user, or null if no file was selected.
|
static File |
getUserSelectedFile(Component parent,
String aFileEnding,
String aFileFormatDescription,
String aDialogTitle,
String lastSelectedFolder,
String aSuggestedFileName,
boolean openDialog)
Returns the file selected by the user, or null if no file was selected.
|
static File |
getUserSelectedFolder(Component parent,
String aDialogTitle,
String lastSelectedFolder,
String aFolderDescription,
String approveButtonText,
boolean openDialog)
Returns the folder selected by the user, or null if no folder was
selected.
|
public static File getUserSelectedFile(Component parent, String aFileEnding, String aFileFormatDescription, String aDialogTitle, String lastSelectedFolder, String aSuggestedFileName, boolean openDialog)
parent
- the parent dialog or frameaFileEnding
- the file type, e.g., .txtaFileFormatDescription
- the file format description, e.g., (Mascot
Generic Format) *.mgfaDialogTitle
- the title for the dialoglastSelectedFolder
- the last selected folderaSuggestedFileName
- the suggested file name, can be nullopenDialog
- if true an open dialog is shown, false results in a
save dialogpublic static FileAndFileFilter getUserSelectedFile(Component parent, String[] fileEndings, String[] fileFormatDescriptions, String aDialogTitle, String lastSelectedFolder, String aSuggestedFileName, boolean openDialog, boolean formatSelectedByUser, boolean showAllFilesOption, int defaultFilterIndex)
parent
- the parent dialog or framefileEndings
- the file types, e.g., .txtfileFormatDescriptions
- the file format description, e.g., (Mascot
Generic Format) *.mgfaDialogTitle
- the title for the dialoglastSelectedFolder
- the last selected folderaSuggestedFileName
- the suggested file name, can be nullopenDialog
- if true an open dialog is shown, false results in a
save dialogformatSelectedByUser
- if true the user will have to select the
format by himself, otherwise all formats will be availableshowAllFilesOption
- if true, the 'All files' filter option will be
includeddefaultFilterIndex
- the index of the filter selected by defaultpublic static File getUserSelectedFolder(Component parent, String aDialogTitle, String lastSelectedFolder, String aFolderDescription, String approveButtonText, boolean openDialog)
parent
- the parent dialog or frameaDialogTitle
- the title for the dialoglastSelectedFolder
- the last selected folderaFolderDescription
- the folder description, e.g., PSDB FolderapproveButtonText
- the text on the approve buttonopenDialog
- if true the folder has to exist, if false the user will
be asked if he/she wants to create the folder is missingCopyright © 2021. All rights reserved.