Here you can find the source of showErrorMessage(Component parent, Throwable error)
public static void showErrorMessage(Component parent, Throwable error)
//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); } }