Java JOptionPane Confirmation showConfirmationDialog(Component parent, String message)

Here you can find the source of showConfirmationDialog(Component parent, String message)

Description

Method description

License

LGPL

Parameter

Parameter Description
parent a parameter
message a parameter

Declaration

public static boolean showConfirmationDialog(Component parent, String message) 

Method Source Code

//package com.java2s;
/*/*from  w w  w .jav  a 2 s  . c  om*/
 * Copyright (c) 2007-2012 The Broad Institute, Inc.
 * SOFTWARE COPYRIGHT NOTICE
 * This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved.
 *
 * This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality.
 *
 * This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
 * Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
 */

import javax.swing.*;
import java.awt.*;

public class Main {
    /**
     * Method description
     *
     * @param parent
     * @param message
     * @return
     */
    public static boolean showConfirmationDialog(Component parent, String message) {

        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;
    }
}

Related

  1. showConfirm(final Component rootComponent, final String message, final String title)
  2. showConfirm(String message)
  3. showConfirmation(Component component, String message)
  4. showConfirmation(Component parent, String message)
  5. showConfirmation(String msg)
  6. showConfirmationDialog(String title, String question)
  7. showConfirmDialog(Component parentComponent, Object message, String title)
  8. showConfirmDialog(final Component parent, final String title, final String message)
  9. showConfirmDialog(final Component parentComponent, final String message)