List of utility methods to do JOptionPane Confirmation
int | showConfirm(final Component rootComponent, final String message, final String title) show Confirm return showConfirm(rootComponent, message, title, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE);
|
boolean | showConfirm(String message) show Confirm return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, message, "Warning", JOptionPane.YES_NO_OPTION); |
boolean | showConfirmation(Component component, String message) show Confirmation return JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(component), message, UIManager.getString("OptionPane.titleText"), JOptionPane.OK_OPTION | JOptionPane.CANCEL_OPTION) == JOptionPane.OK_OPTION; |
boolean | showConfirmation(Component parent, String message) Show a confirmation dialog. boolean confirmed = false; if (JOptionPane.showConfirmDialog(parent, message) == JOptionPane.YES_OPTION) { confirmed = true; return confirmed; |
boolean | showConfirmation(String msg) show Confirmation int res = JOptionPane.showConfirmDialog(null, msg, "Confirmation", JOptionPane.YES_NO_OPTION); return (res == 0); |
boolean | showConfirmationDialog(Component parent, String message) Method description int status = JOptionPane.showConfirmDialog(parent, message, null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if ((status == JOptionPane.CANCEL_OPTION) || (status == JOptionPane.CLOSED_OPTION)) { return false; return true; |
boolean | showConfirmationDialog(String title, String question) show Confirmation Dialog int result = JOptionPane.showOptionDialog(null, new JLabel("<html><body>" + question.replaceAll("\n", "<br>") + "</body></html>"), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); return result == JOptionPane.YES_OPTION; |
int | showConfirmDialog(Component parentComponent, Object message, String title) Shows a simple yes/no confirmation dialog, with the "no" option selected by default. String[] options = { "Yes", "No" }; return JOptionPane.showOptionDialog(parentComponent, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); |
int | showConfirmDialog(final Component parent, final String title, final String message) Shows a confirm dialog. return JOptionPane.showConfirmDialog(parent, message, title, JOptionPane.OK_CANCEL_OPTION);
|
boolean | showConfirmDialog(final Component parentComponent, final String message) show Confirm Dialog final int result = JOptionPane.showConfirmDialog(parentComponent, message, "Confirmation", JOptionPane.YES_NO_OPTION); return result == JOptionPane.YES_OPTION; |