Java JOptionPane Warning warning(String message, Component parent)

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

Description

Show a warning window.

License

Open Source License

Parameter

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

Declaration

public static void warning(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 {
    /**// w w w  .  j a  v  a  2s. c  o  m
     * Show an warning window.
     * @param message   The message to show.
     */
    public static void warning(String message) {
        warning(message, null);
    }

    /**
     * Show a warning window.
     * @param message   The message to show.
     * @param parent   Parent component of this dialog.
     */
    public static void warning(String message, Component parent) {
        Toolkit.getDefaultToolkit().beep();
        JOptionPane.showMessageDialog(parent, message, "Warning", JOptionPane.WARNING_MESSAGE);
    }
}

Related

  1. showWarningMessage(String title, String message, java.awt.Component parent)
  2. warn(Component parent, String message)
  3. warn(Component parent, String message)
  4. warn(Component parent, String message)
  5. warn(String message)
  6. warning(String Msg)
  7. warning(String msg)
  8. warning(String title, Object message, JComponent parent)
  9. warningMessage(Component component, String title, String message)