Java Utililty Methods JOptionPane Confirmation

List of utility methods to do JOptionPane Confirmation

Description

The list of methods to do JOptionPane Confirmation are organized into topic(s).

Method

booleanaskConfirmation(final Window aWindow, final String aMessage, final String aTitle)
Asks the user for confirmation.
return JOptionPane.showConfirmDialog(aWindow, aMessage, aTitle, JOptionPane.YES_NO_OPTION,
        JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION;
booleanconfirm(Component component, String title, String msg)
confirm
int rtn = JOptionPane.showConfirmDialog(component, msg, title, JOptionPane.OK_CANCEL_OPTION);
return (rtn == JOptionPane.OK_OPTION);
booleanconfirm(final Component component, final String title, final String message)
Asks the user a yes or no question.
if (!SwingUtilities.isEventDispatchThread()) {
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                confirmResult = confirm(component, title, message);
        });
...
booleanconfirm(String message)
confirm
return confirm(null, message);
booleanconfirm(String message)
confirm
Object[] options = { "Si", "No" };
int n = JOptionPane.showOptionDialog(new Frame(), message, "Confirmar", JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
return n == 0;
booleanconfirm(String message, boolean typeYesNo)
Pops up a confirmation dialog that requires user to type the word Yes into a text field in order to confirm the question asked.
if (typeYesNo) {
    StringBuffer fullMsg = new StringBuffer(message);
    fullMsg.append(NEWLINE);
    fullMsg.append(NEWLINE);
    fullMsg.append(resUtil.getString("YesNoMessage"));
    String answer = javax.swing.JOptionPane.showInputDialog(null, fullMsg.toString(),
            resUtil.getString("YesNoTitle"), javax.swing.JOptionPane.QUESTION_MESSAGE);
    return (answer != null && answer.equalsIgnoreCase(resUtil.getString("Yes")));
...
booleanconfirm(String message, String title)
confirm
return JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_CANCEL_OPTION,
        JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION;
booleanconfirm(String msg)
Mnenomic for JOptionPane#showConfirmDialog(Component,Object)
int opt = JOptionPane.showConfirmDialog(null, msg);
return opt == JOptionPane.OK_OPTION;
booleanconfirm(String title, Object message, JComponent parent)
Muestra un dialogo de confirmacion.
int option = JOptionPane.showConfirmDialog(parent, message, title, JOptionPane.OK_CANCEL_OPTION,
        JOptionPane.QUESTION_MESSAGE);
return JOptionPane.OK_OPTION == option;
booleanconfirmAction(Component comp, String title, String msg)
confirm Action
int decision = JOptionPane.showConfirmDialog(comp, msg, title, JOptionPane.YES_NO_OPTION,
        JOptionPane.WARNING_MESSAGE);
if (decision == JOptionPane.NO_OPTION) {
    return false;
return true;