Java Utililty Methods JOptionPane Error

List of utility methods to do JOptionPane Error

Description

The list of methods to do JOptionPane Error are organized into topic(s).

Method

voidshowError(Component parent, String message)
Show error message
JOptionPane.showMessageDialog(parent, message, "Error", JOptionPane.ERROR_MESSAGE);
voidshowError(Component parentComponent, Exception e)
show Error
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
JOptionPane.showMessageDialog(parentComponent, sw.toString());
voidshowError(Component where, String msg)
show Error
JOptionPane.showMessageDialog(where, msg, "Error", JOptionPane.ERROR_MESSAGE);
voidshowError(Exception e)
show Error
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
e.printStackTrace(ps);
String trace = baos.toString();
e.printStackTrace();
JOptionPane.showMessageDialog(null, trace, e.toString(), JOptionPane.ERROR_MESSAGE);
voidshowError(Exception e)
show Error
showError(e, "");
voidshowError(Exception e)
Show application error
JOptionPane.showMessageDialog(null, e.getMessage(), "Application error", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
voidshowError(final Component component, final String title, final String message)
Shows an error dialog.
if (!SwingUtilities.isEventDispatchThread()) {
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                showError(component, title, message);
        });
...
voidshowError(final Component rootComponent, final String message, final String title)
show Error
JOptionPane.showMessageDialog(rootComponent, message, title, JOptionPane.ERROR_MESSAGE);
voidshowError(JComponent parent, Throwable e)
show Error
showError(parent, null, e);
voidshowError(JFrame owner, ImageIcon image, String title, String message, String text)
show Error
if (owner == null || !owner.isVisible()) {
    System.out.println(text);
} else {
    final JDialog frame = new JDialog(owner, true);
    frame.setTitle(title);
    frame.setLayout(new BorderLayout());
    JLabel label = new JLabel(message, image, SwingConstants.LEFT);
    label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
...