Java JOptionPane Error error(String message, Component parent)

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

Description

Show an alert window.

License

Open Source License

Parameter

Parameter Description
message The message to show.
parent Parent component of this dialog.

Declaration

public static void error(String message, Component parent) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009-2014 Black Rook Software
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 ******************************************************************************/

import java.awt.Component;

import java.awt.Toolkit;

import javax.swing.JOptionPane;

public class Main {
    /**//ww w .j  a va  2 s  .co  m
     * Show an alert window.
     * @param message   The message to show.
     */
    public static void error(String message) {
        error(message, null);
    }

    /**
     * Show an alert window.
     * @param message   The message to show.
     * @param parent   Parent component of this dialog.
     */
    public static void error(String message, Component parent) {
        Toolkit.getDefaultToolkit().beep();
        JOptionPane.showMessageDialog(parent, message, "Alert", JOptionPane.ERROR_MESSAGE);
    }
}

Related

  1. error(Component parent, Exception e)
  2. error(Component parent, String message)
  3. error(Component parent, String message)
  4. error(Exception ex)
  5. error(final Component component, final Object msg)
  6. error(String message, String title)
  7. errorMessage(Component component, String title, String message)
  8. errorMessage(Component parent, Throwable t)
  9. errorMessage(Exception exceptionMsg, boolean quiet)