Java Code Examples for javax.swing.JOptionPane#INFORMATION_MESSAGE
The following examples show how to use
javax.swing.JOptionPane#INFORMATION_MESSAGE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesktopGDXProgressDialog.java From gdx-dialogs with Apache License 2.0 | 6 votes |
@Override public GDXProgressDialog build() { optionPane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {}, null); dialog = new JDialog(); dialog.setTitle((String) title); dialog.setModal(true); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); dialog.pack(); return this; }
Example 2
Source File: MessageDialogs.java From FancyBing with GNU General Public License v3.0 | 6 votes |
public void showInfo(String disableKey, Component frame, String mainMessage, String optionalMessage, boolean isCritical) { if (checkDisabled(disableKey)) return; int type; if (isCritical) type = JOptionPane.INFORMATION_MESSAGE; else type = JOptionPane.PLAIN_MESSAGE; Object[] options = { i18n("LB_CLOSE") }; Object defaultOption = options[0]; show(disableKey, frame, "", mainMessage, optionalMessage, type, JOptionPane.DEFAULT_OPTION, options, defaultOption, -1); }
Example 3
Source File: UserMessageHelper.java From openAGV with Apache License 2.0 | 6 votes |
private int translateType(Type type) { int jOptionType; switch (type) { case ERROR: jOptionType = JOptionPane.ERROR_MESSAGE; break; case INFO: jOptionType = JOptionPane.INFORMATION_MESSAGE; break; case QUESTION: jOptionType = JOptionPane.YES_NO_OPTION; break; default: jOptionType = JOptionPane.PLAIN_MESSAGE; } return jOptionType; }
Example 4
Source File: StartupDialog.java From visualvm with GNU General Public License v2.0 | 5 votes |
private static int styleFromMessageType(int messageType) { switch (messageType) { case JOptionPane.ERROR_MESSAGE: return JRootPane.ERROR_DIALOG; case JOptionPane.QUESTION_MESSAGE: return JRootPane.QUESTION_DIALOG; case JOptionPane.WARNING_MESSAGE: return JRootPane.WARNING_DIALOG; case JOptionPane.INFORMATION_MESSAGE: return JRootPane.INFORMATION_DIALOG; case JOptionPane.PLAIN_MESSAGE: default: return JRootPane.PLAIN_DIALOG; } }
Example 5
Source File: UiUtils.java From pgptool with GNU General Public License v3.0 | 5 votes |
public static void messageBox(ActionEvent originEvent, String messageText, String messageTitle, MessageSeverity messageSeverity) { int messageType = JOptionPane.INFORMATION_MESSAGE; if (messageSeverity == MessageSeverity.ERROR) { messageType = JOptionPane.ERROR_MESSAGE; } else if (messageSeverity == MessageSeverity.WARNING) { messageType = JOptionPane.WARNING_MESSAGE; } else if (messageSeverity == MessageSeverity.INFO) { messageType = JOptionPane.INFORMATION_MESSAGE; } UiUtils.messageBox(originEvent, messageText, messageTitle, messageType); }
Example 6
Source File: MultiSizeIssue.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public static void chooseBandsWithSameSize() { String title = Dialogs.getDialogTitle("Choose bands with same size."); int optionType = JOptionPane.OK_CANCEL_OPTION; int messageType = JOptionPane.INFORMATION_MESSAGE; final StringBuilder msgTextBuilder = new StringBuilder("The functionality you have chosen is not supported for bands of different sizes.<br/>"); JPanel panel = new JPanel(new BorderLayout(4, 4)); final JEditorPane textPane = new JEditorPane("text/html", msgTextBuilder.toString()); setFont(textPane); textPane.setEditable(false); textPane.setOpaque(false); textPane.addHyperlinkListener(e -> { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException | URISyntaxException e1) { Dialogs.showWarning("Could not open URL: " + e.getDescription()); } } }); panel.add(textPane, BorderLayout.CENTER); final JComboBox<Object> resamplerBox = new JComboBox<>(); NotifyDescriptor d = new NotifyDescriptor(panel, title, optionType, messageType, null, null); DialogDisplayer.getDefault().notify(d); }
Example 7
Source File: SwingNotifier.java From MtgDesktopCompanion with GNU General Public License v3.0 | 5 votes |
private int convert(MESSAGE_TYPE type) { switch(type) { case ERROR : return JOptionPane.ERROR_MESSAGE; case INFO : return JOptionPane.INFORMATION_MESSAGE; case WARNING : return JOptionPane.WARNING_MESSAGE; case NONE : return 0; default: return JOptionPane.INFORMATION_MESSAGE; } }
Example 8
Source File: AutoUpgrade.java From netbeans with Apache License 2.0 | 4 votes |
private static void showNoteDialog (String note) { Util.setDefaultLookAndFeel(); JOptionPane p = new JOptionPane(new AutoUpgradePanel (null, note), JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION); JDialog d = Util.createJOptionDialog(p, NbBundle.getMessage (AutoUpgrade.class, "MSG_Note_Title")); d.setVisible (true); }
Example 9
Source File: DialogCallbackHandler.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 10
Source File: DialogCallbackHandler.java From hottub with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 11
Source File: MultiSizeIssue.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
public static Product maybeResample(Product product) { String title = Dialogs.getDialogTitle("Resampling Required"); final List<Resampler> availableResamplers = getAvailableResamplers(product); int optionType; int messageType; final StringBuilder msgTextBuilder = new StringBuilder("The functionality you have chosen is not supported for products with bands of different sizes.<br/>"); if (availableResamplers.isEmpty()) { optionType = JOptionPane.OK_CANCEL_OPTION; messageType = JOptionPane.INFORMATION_MESSAGE; } else if (availableResamplers.size() == 1) { msgTextBuilder.append("You can use the ").append(availableResamplers.get(0).getName()). append(" to resample this product so that all bands have the same size, <br/>" + "which will enable you to use this feature.<br/>" + "Do you want to resample the product now?"); optionType = JOptionPane.YES_NO_OPTION; messageType = JOptionPane.QUESTION_MESSAGE; } else { msgTextBuilder.append("You can use one of these resamplers to resample this product so that all bands have the same size, <br/>" + "which will enable you to use this feature.<br/>" + "Do you want to resample the product now?"); optionType = JOptionPane.YES_NO_OPTION; messageType = JOptionPane.QUESTION_MESSAGE; } msgTextBuilder.append("<br/>" + "<br/>" + "More info about this issue and its status can be found in the " + "<a href=\"https://senbox.atlassian.net/browse/SNAP-1\">SNAP Issue Tracker</a>." ); JPanel panel = new JPanel(new BorderLayout(4, 4)); final JEditorPane textPane = new JEditorPane("text/html", msgTextBuilder.toString()); setFont(textPane); textPane.setEditable(false); textPane.setOpaque(false); textPane.addHyperlinkListener(e -> { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException | URISyntaxException e1) { Dialogs.showWarning("Could not open URL: " + e.getDescription()); } } }); panel.add(textPane, BorderLayout.CENTER); final JComboBox<Object> resamplerBox = new JComboBox<>(); if (availableResamplers.size() > 1) { String[] resamplerNames = new String[availableResamplers.size()]; for (int i = 0; i < availableResamplers.size(); i++) { resamplerNames[i] = availableResamplers.get(i).getName(); resamplerBox.addItem(resamplerNames[i]); } panel.add(resamplerBox, BorderLayout.SOUTH); } NotifyDescriptor d = new NotifyDescriptor(panel, title, optionType, messageType, null, null); DialogDisplayer.getDefault().notify(d); if (d.getValue() == NotifyDescriptor.YES_OPTION) { Resampler selectedResampler; if (availableResamplers.size() == 1) { selectedResampler = availableResamplers.get(0); } else { selectedResampler = availableResamplers.get(resamplerBox.getSelectedIndex()); } return selectedResampler.resample(product); } return null; }
Example 12
Source File: DialogCallbackHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 13
Source File: DialogCallbackHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 14
Source File: DialogCallbackHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 15
Source File: UiUtils.java From netbeans with Apache License 2.0 | 4 votes |
public static boolean showMessageDialog( final String message, final String title, final MessageType messageType) { initLAF(); boolean exitInstaller = false; switch (UiMode.getCurrentUiMode()) { case SWING: int intMessageType = JOptionPane.INFORMATION_MESSAGE; LogManager.logIndent("... show message dialog"); LogManager.log("title: "+ title); LogManager.log("message: " + message); if (messageType == MessageType.WARNING) { intMessageType = JOptionPane.WARNING_MESSAGE; } else if (messageType == MessageType.CRITICAL) { intMessageType = JOptionPane.ERROR_MESSAGE; exitInstaller = true; } if (messageType == MessageType.ERROR) { int result = JOptionPane.showOptionDialog(null, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, null, JOptionPane.YES_OPTION); if (result == JOptionPane.NO_OPTION) { exitInstaller = true; LogManager.logUnindent("... user selected: NO"); } else { LogManager.logUnindent("... user selected: YES"); } } else { JOptionPane.showMessageDialog(null, message, title, intMessageType); } LogManager.logUnindent("... dialog closed"); break; case SILENT: LogManager.log(message); System.err.println(message); break; } return exitInstaller; }
Example 16
Source File: DialogCallbackHandler.java From JDKSourceCode1.8 with MIT License | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 17
Source File: DialogCallbackHandler.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 18
Source File: DialogCallbackHandler.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 19
Source File: DialogCallbackHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }
Example 20
Source File: DialogCallbackHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException { this.callback = callback; int confirmationOptionType = callback.getOptionType(); switch (confirmationOptionType) { case ConfirmationCallback.YES_NO_OPTION: optionType = JOptionPane.YES_NO_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO }; break; case ConfirmationCallback.YES_NO_CANCEL_OPTION: optionType = JOptionPane.YES_NO_CANCEL_OPTION; translations = new int[] { JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.OK_CANCEL_OPTION: optionType = JOptionPane.OK_CANCEL_OPTION; translations = new int[] { JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL }; break; case ConfirmationCallback.UNSPECIFIED_OPTION: options = callback.getOptions(); /* * There's no way to know if the default option means * to cancel the login, but there isn't a better way * to guess this. */ translations = new int[] { JOptionPane.CLOSED_OPTION, callback.getDefaultOption() }; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized option type: " + confirmationOptionType); } int confirmationMessageType = callback.getMessageType(); switch (confirmationMessageType) { case ConfirmationCallback.WARNING: messageType = JOptionPane.WARNING_MESSAGE; break; case ConfirmationCallback.ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case ConfirmationCallback.INFORMATION: messageType = JOptionPane.INFORMATION_MESSAGE; break; default: throw new UnsupportedCallbackException( callback, "Unrecognized message type: " + confirmationMessageType); } }