public class Dialogs extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Dialogs.Answer |
Modifier and Type | Field and Description |
---|---|
static String |
PREF_KEY_SUFFIX_DONTSHOW |
Modifier and Type | Method and Description |
---|---|
static String |
getDialogTitle(String titleText) |
static Dialogs.Answer |
requestDecision(String title,
String message,
boolean allowCancel,
String preferencesKey)
Displays a modal dialog which requests a decision from the user.
|
static File |
requestFileForOpen(String title,
boolean dirsOnly,
FileFilter fileFilter,
String preferencesKey)
Opens a standard file-open dialog box.
|
static File |
requestFileForSave(String title,
boolean dirsOnly,
FileFilter fileFilter,
String defaultExtension,
String fileName,
JComponent accessory,
String preferenceKey)
Opens a standard save dialog box.
|
static Boolean |
requestOverwriteDecision(String title,
File file)
Opens question dialog asking the user whether or not to overwrite an existing file.
|
static void |
showError(String message)
Displays a modal dialog with the provided error message text.
|
static void |
showError(String title,
String message)
Displays a modal dialog with the provided error message text.
|
static void |
showInformation(String message)
Displays a modal dialog with the provided information message text.
|
static void |
showInformation(String message,
String preferencesKey)
Displays a modal dialog with the provided information message text.
|
static void |
showInformation(String title,
String message,
String preferencesKey)
Displays a modal dialog with the provided information message text.
|
static void |
showMessage(String title,
String message,
int messageType,
String preferencesKey)
Displays a modal dialog with the provided message text.
|
static void |
showOutOfMemoryError(String message)
Displays a modal dialog indicating an 'Out of Memory'-error with the
provided error message text.
|
static void |
showWarning(String message)
Displays a modal dialog with the provided warning message text.
|
static void |
showWarning(String title,
String message,
String preferencesKey)
Displays a modal dialog with the provided warning message text.
|
public static final String PREF_KEY_SUFFIX_DONTSHOW
public static void showInformation(String message)
message
- The message text to be displayed.public static void showInformation(String message, String preferencesKey)
message
- The message text to be displayed.preferencesKey
- If not null
, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answerpublic static void showInformation(String title, String message, String preferencesKey)
title
- The dialog title. May be null
.message
- The information message text to be displayed.preferencesKey
- If not null
, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answerpublic static void showWarning(String message)
message
- The information message text to be displayed.public static void showWarning(String title, String message, String preferencesKey)
title
- The dialog title. May be null
.message
- The warning message text to be displayed.preferencesKey
- If not null
, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answerpublic static void showError(String message)
message
- The error message text to be displayed.public static void showError(String title, String message)
title
- The dialog title. May be null
.message
- The error message text to be displayed.public static void showOutOfMemoryError(String message)
message
- The error message text to be displayed.public static void showMessage(String title, String message, int messageType, String preferencesKey)
title
- The dialog title. May be null
.message
- The message text to be displayed.messageType
- The type of the message.preferencesKey
- If not null
, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answerpublic static Dialogs.Answer requestDecision(String title, String message, boolean allowCancel, String preferencesKey)
title
- The dialog title. May be null
.message
- The question text to be displayed.allowCancel
- If true
, the dialog also offers a cancel button.preferencesKey
- If not null
, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answerDialogs.Answer.YES
, Dialogs.Answer.NO
, or Dialogs.Answer.CANCELLED
.public static Boolean requestOverwriteDecision(String title, File file)
file
- the file to check for existanceTrue
if the user confirms the dialog with 'yes' or the given file does not exist.False
if the user does not want to overwrite the existing file.null
if the user canceled the operation.public static File requestFileForOpen(String title, boolean dirsOnly, FileFilter fileFilter, String preferencesKey)
title
- a dialog-box titledirsOnly
- whether or not to select only directoriesfileFilter
- the file filter to be used, can be null
preferencesKey
- the key under which the last directory the user visited is storednull
if the user canceled file selectionpublic static File requestFileForSave(String title, boolean dirsOnly, FileFilter fileFilter, String defaultExtension, String fileName, JComponent accessory, String preferenceKey)
title
- A dialog-box title.dirsOnly
- Whether or not to select only directories.fileFilter
- The file filter to be used, can be null
.defaultExtension
- The extension used as default.fileName
- The initial filename.accessory
- An accessory UI component to be shown in the file chooser
,
can be null
.preferenceKey
- The key under which the last directory the user visited is stored.null
if the user cancelled the file selection.Copyright © 2014–2015 European Space Agency (ESA). All rights reserved.