show Error Dialog - Java Swing

Java examples for Swing:JOptionPane

Description

show Error Dialog

Demo Code


//package com.java2s;
import javax.swing.JOptionPane;

public class Main {
    private static final String DEFAULT_ERROR_TITLE = "Error";

    public static void showErrorDialog(Exception exception) {
        showErrorDialog(exception.getMessage());
    }//from w  ww  . j  a  va  2s .  c o  m

    public static void showErrorDialog(String message) {
        JOptionPane.showMessageDialog(null, message, DEFAULT_ERROR_TITLE,
                JOptionPane.ERROR_MESSAGE);
    }
}

Related Tutorials