Java JOptionPane Error errMsg(Component owner, String msg, Exception e)

Here you can find the source of errMsg(Component owner, String msg, Exception e)

Description

show an error message and print a stack trace to the console if in development mode (DEV_MODE = true)

License

Open Source License

Parameter

Parameter Description
owner the owner of the message, or null
msg the message to display, or null
e the exception object describing the error, or null

Declaration

public static void errMsg(Component owner, String msg, Exception e) 

Method Source Code


//package com.java2s;
/*//  w ww  . j  a va 2 s.c  o  m
 * This file is part of the Scriba source distribution. This is free, open-source 
 * software. For full licensing information, please see the LicensingInformation file
 * at the root level of the distribution.
 *
 * Copyright (c) 2006-2007 Kobrix Software, Inc.
 */

import java.awt.Component;

import javax.swing.JOptionPane;

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

    /**
     * show an error message and print a stack trace to the console if in
     * development mode (DEV_MODE = true)
     * 
     * @param owner the owner of the message, or null
     * @param msg the message to display, or null
     * @param e the exception object describing the error, or null
     */
    public static void errMsg(Component owner, String msg, Exception e) {
        if (msg != null) {
            JOptionPane.showMessageDialog(owner, msg, ERR_TITLE, JOptionPane.ERROR_MESSAGE);
        }
        if (e != null) {
            e.printStackTrace();
        }
    }
}

Related

  1. displayErrorMessage(Component parent, String message)
  2. displayErrorMessage(Component parentComponent, String message, String windowTitle)
  3. displayErrorMessage(final Throwable throwable, final Component parentComponent)
  4. displayErrorMessage(String msg, Throwable t)
  5. displayErrors(Component parent, List errors)
  6. errMsg(final Component owner, final String msg, final Throwable e)
  7. errMsg(final String msg)
  8. errMsg(String msg)
  9. error(Component comp, String title, String message, Object[] args)