Java JOptionPane Error displayErrorMessage(Component parentComponent, String message, String windowTitle)

Here you can find the source of displayErrorMessage(Component parentComponent, String message, String windowTitle)

Description

display Error Message

License

Open Source License

Declaration

public static void displayErrorMessage(Component parentComponent,
            String message, String windowTitle) 

Method Source Code

//package com.java2s;
/*/*w w w .j  a v  a  2 s  .  co  m*/
 * Copyright (C) 2007-2014 Dylan Bumford, Lucas Champollion, Maribel Romero
 * and Joshua Tauberer
 * 
 * This file is part of The Lambda Calculator.
 * 
 * The Lambda Calculator is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * 
 * The Lambda Calculator is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with The Lambda Calculator.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

import java.awt.*;

import javax.swing.JDialog;
import javax.swing.JOptionPane;

public class Main {
    public static void displayErrorMessage(Component parentComponent,
            String message, String windowTitle) {

        displayMessage(parentComponent, message, windowTitle,
                JOptionPane.ERROR_MESSAGE);
    }

    private static void displayMessage(Component parentComponent,
            String message, String windowTitle, int messageType) {
        JOptionPane p = new JOptionPane(message, messageType) {
            public int getMaxCharactersPerLineCount() {
                return 72;
            }

        };
        p.setMessage(message);
        JDialog dialog = p.createDialog(parentComponent, windowTitle);
        dialog.setVisible(true);
    }
}

Related

  1. displayError(Component parent, String title, String message)
  2. displayError(String message)
  3. displayError(Throwable e)
  4. displayErrorMessage(Component component, Throwable t)
  5. displayErrorMessage(Component parent, String message)
  6. displayErrorMessage(final Throwable throwable, final Component parentComponent)
  7. displayErrorMessage(String msg, Throwable t)
  8. displayErrors(Component parent, List errors)
  9. errMsg(Component owner, String msg, Exception e)