/** * Displays a modal dialog with the provided error message text. * * @param title The dialog title. May be {@code null}. * @param message The error message text to be displayed. */ public static void showError(String title, String message) { showMessage(title != null ? title : Bundle.LBL_Error(), message, JOptionPane.ERROR_MESSAGE, null); }
/** * Displays a modal dialog with the provided information message text. * * @param title The dialog title. May be {@code null}. * @param message The information message text to be displayed. * @param preferencesKey If not {@code null}, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer */ public static void showInformation(String title, String message, String preferencesKey) { showMessage(title != null ? title : Bundle.LBL_Information(), message, JOptionPane.INFORMATION_MESSAGE, preferencesKey); }
/** * Displays a modal dialog with the provided warning message text. * * @param title The dialog title. May be {@code null}. * @param message The warning message text to be displayed. * @param preferencesKey If not {@code null}, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer */ public static void showWarning(String title, String message, String preferencesKey) { showMessage(title != null ? title : Bundle.LBL_Warning(), message, JOptionPane.WARNING_MESSAGE, preferencesKey); }
title = getDialogTitle(title != null ? title : Bundle.LBL_Message()); if (preferencesKey != null) { String decision = getPreferences().get(preferencesKey + PREF_KEY_SUFFIX_DONTSHOW, ""); JCheckBox dontShowCheckBox = new JCheckBox(Bundle.LBL_DoNotShowThisMessage(), false); panel.add(dontShowCheckBox, BorderLayout.SOUTH); NotifyDescriptor d = new NotifyDescriptor(panel, title, JOptionPane.DEFAULT_OPTION, messageType, null, null);
boolean storeResult; int optionType = allowCancel ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION; title = getDialogTitle(title != null ? title : Bundle.LBL_Question()); if (preferencesKey != null) { String decision = getPreferences().get(preferencesKey + PREF_KEY_SUFFIX_DECISION, ""); return Answer.NO; JCheckBox decisionCheckBox = new JCheckBox(Bundle.LBL_QuestionRemember(), false); NotifyDescriptor d = new NotifyDescriptor.Confirmation(new Object[]{message, decisionCheckBox}, title, optionType); result = DialogDisplayer.getDefault().notify(d);
/** * Displays a modal dialog with the provided information message text. * * @param message The message text to be displayed. * @param preferencesKey If not {@code null}, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer */ public static void showInformation(String message, String preferencesKey) { showInformation(Bundle.LBL_Information(), message, preferencesKey); }