Java examples for Swing:JOptionPane
show Exception Message via JOptionPane
//package com.java2s; import java.awt.Component; import javax.swing.JOptionPane; public class Main { private static Component mainComponent = null; public static void showExceptionMessage(Exception e) { String msg = "An exception has occurred.\n\n" + e.toString()//from www .j a v a2s. co m + "\n\nIf problems persist, please contact your local administrator."; // log exception e.printStackTrace(System.out); JOptionPane.showMessageDialog(mainComponent, msg, "Exception", JOptionPane.ERROR_MESSAGE); } }