/** * Popup a dialog displaying the supplied Exception * * @param cause the exception to show */ @Override public void showErrorDialog(Exception cause) { String stackTrace = LogManager.stackTraceToString(cause); Object[] options = null; if (stackTrace != null && stackTrace.length() > 0) { options = new Object[2]; options[0] = "OK"; options[1] = "Show error"; } else { options = new Object[1]; options[0] = "OK"; } int result = JOptionPane.showOptionDialog(this, "An error has occurred: " + cause.getMessage(), getApplicationName(), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (result == 1) { JTextArea jt = new JTextArea(stackTrace, 10, 40); JOptionPane.showMessageDialog(this, new JScrollPane(jt), getApplicationName(), JOptionPane.ERROR_MESSAGE); } }
/** * Popup a dialog displaying the supplied Exception * * @param cause the exception to show */ @Override public void showErrorDialog(Exception cause) { String stackTrace = LogManager.stackTraceToString(cause); Object[] options = null; if (stackTrace != null && stackTrace.length() > 0) { options = new Object[2]; options[0] = "OK"; options[1] = "Show error"; } else { options = new Object[1]; options[0] = "OK"; } int result = JOptionPane.showOptionDialog(this, "An error has occurred: " + cause.getMessage(), getApplicationName(), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); if (result == 1) { JTextArea jt = new JTextArea(stackTrace, 10, 40); JOptionPane.showMessageDialog(this, new JScrollPane(jt), getApplicationName(), JOptionPane.ERROR_MESSAGE); } }