Java JOptionPane Error errorMessage(Component parent, Throwable t)

Here you can find the source of errorMessage(Component parent, Throwable t)

Description

Display an error dialog with the exception.

License

Open Source License

Parameter

Parameter Description
parent the parent component
t the exception

Declaration

public static void errorMessage(Component parent, Throwable t) 

Method Source Code


//package com.java2s;
/*//from w ww. j  av  a  2s.  co  m
 * Copyright 2010-2012 The Advance EU 7th Framework project consortium
 *
 * This file is part of Advance.
 *
 * Advance is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * Advance 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Advance.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 */

import java.awt.Component;

import javax.swing.JOptionPane;

public class Main {
    /**
     * Display an error dialog with the message.
     * @param parent the parent component
     * @param text the message
     */
    public static void errorMessage(Component parent, String text) {
        JOptionPane.showMessageDialog(parent, text, "Error", JOptionPane.ERROR_MESSAGE);
    }

    /**
     * Display an error dialog with the exception.
     * @param parent the parent component
     * @param t the exception
     */
    public static void errorMessage(Component parent, Throwable t) {
        t.printStackTrace();
        JOptionPane.showMessageDialog(parent, t.toString(), "Error", JOptionPane.ERROR_MESSAGE);
    }
}

Related

  1. error(Exception ex)
  2. error(final Component component, final Object msg)
  3. error(String message, Component parent)
  4. error(String message, String title)
  5. errorMessage(Component component, String title, String message)
  6. errorMessage(Exception exceptionMsg, boolean quiet)
  7. exibeMsgErro(String msg)
  8. getIconError()
  9. guiError(String errormsg, String errortitle)