JOptionPane.showMessageDialog(parent, panel, application .getMessage(titleKey), JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(parent, panel, getTitle(titleKey), JOptionPane.ERROR_MESSAGE);
    public void showErrorMessage(Component parent, String msgKey,            String titleKey, Throwable e, Object... args) {        final List<String> stackTraceElementList = createStackTraceElementList(e);        stackTraceElementList.add(0, e.toString());        final StringBuffer message = new StringBuffer();        message.append(application.getMessage(msgKey, args));        Throwable cause = e.getCause();        for (int i = 0; (i < 5) && (cause != null); ++i) {            final List<String> causeStackTraceElementList = createStackTraceElementList(e                    .getCause());            stackTraceElementList.add("Caused by: " + e.getCause());            stackTraceElementList.addAll(causeStackTraceElementList);            if (cause instanceof ApplicationException) {                final ApplicationException appExc = (ApplicationException) cause;                final String msgKey2 = appExc.getKey();                final Object[] args2 = appExc.getArguments();                message.append("\n").append(                        application.getMessage(msgKey2, args2));            }            cause = cause.getCause();        }        final JList list = new JList(stackTraceElementList.toArray());        final JScrollPane scrollPane = new JScrollPane(list,                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);        final Dimension minDim = new Dimension(300, 100);        scrollPane.setMinimumSize(minDim);        scrollPane.setPreferredSize(minDim);        final JTextArea text = new JTextArea(message.toString());        text.setOpaque(false);        text.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));        final JPanel panel = new JPanel(new BorderLayout());        panel.add(scrollPane, BorderLayout.CENTER);        panel.add(text, BorderLayout.NORTH);        JOptionPane.showMessageDialog(parent, panel, application                .getMessage(titleKey), JOptionPane.ERROR_MESSAGE);    }