Java JOptionPane Error contChoose(final Component parent, final String title, final String message, final String noContMsg, boolean cont, boolean error)

Here you can find the source of contChoose(final Component parent, final String title, final String message, final String noContMsg, boolean cont, boolean error)

Description

cont Choose

License

Open Source License

Declaration

private static int contChoose(final Component parent, final String title, final String message,
            final String noContMsg, boolean cont, boolean error) 

Method Source Code

//package com.java2s;
/**//  w  w w  . j  a va 2  s  .  c  o  m
 * This file is part of the Paxle project.
 * Visit http://www.paxle.net for more information.
 * Copyright 2007-2010 the original author or authors.
 *
 * Licensed under the terms of the Common Public License 1.0 ("CPL 1.0").
 * Any use, reproduction or distribution of this program constitutes the recipient's acceptance of this agreement.
 * The full license text is available under http://www.opensource.org/licenses/cpl1.0.txt
 * or in the file LICENSE.txt in the root directory of the Paxle distribution.
 *
 * Unless required by applicable law or agreed to in writing, this software is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */

import java.awt.Component;

import javax.swing.JOptionPane;

public class Main {
    private static int contChoose(final Component parent, final String title, final String message,
            final String noContMsg, boolean cont, boolean error) {
        final int optionType = (error) ? JOptionPane.ERROR_MESSAGE : JOptionPane.WARNING_MESSAGE;
        if (cont) {
            return JOptionPane.showConfirmDialog(parent, message, title, JOptionPane.YES_NO_CANCEL_OPTION,
                    optionType);
        } else {
            JOptionPane.showMessageDialog(parent, noContMsg, title, optionType);
            return -1;
        }
    }
}

Related

  1. alertValidationError(final Component sourceComponent, final String message)
  2. askForAStringInArray(String question, String header, Object[] options, String errorMessage, String errorHeader)
  3. askForAStringInArrayReturning(String question, String header, T[] options, String errorMessage, String errorHeader)
  4. createAndShowErrorPanel(String title, Map messages)
  5. displayError(Component parent, String title, String message)
  6. displayError(String message)
  7. displayError(Throwable e)