Java JOptionPane Error showErrorMessage(Component parent, Throwable error)

Here you can find the source of showErrorMessage(Component parent, Throwable error)

Description

show Error Message

License

Open Source License

Declaration

public static void showErrorMessage(Component parent, Throwable error) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 uniVocity Software Pty Ltd. All rights reserved.
 * This file is subject to the terms and conditions defined in file
 * 'LICENSE.txt', which is part of this source code package.
 ******************************************************************************/

import java.awt.*;
import javax.swing.*;

public class Main {
    public static void showErrorMessage(Component parent, Throwable error) {
        String message;/*from   ww  w  . ja v  a  2  s .  c o  m*/
        if (error.getMessage() != null) {
            message = error.getMessage().replaceAll(":", ":\n");
        } else {
            message = error.getClass().getName();
        }
        error.printStackTrace();
        JOptionPane.showMessageDialog(parent, message, "Error", JOptionPane.ERROR_MESSAGE);

    }
}

Related

  1. showErrorDialog(JFrame parent, Exception ex)
  2. showErrorMessage(Component c, Exception e)
  3. showErrorMessage(Component parent, String message)
  4. showErrorMessage(Component parent, String str)
  5. showErrorMessage(Component parent, String str)
  6. showErrorMessage(Component parentComponent, String message, String title)
  7. showErrorMessage(Component theParent, String theMessage)
  8. showErrorMessage(final JComponent parent, final String message, final String title)
  9. showErrorMessage(final Window aParent, final String aMessage)