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

voiddisplayErrorMessage(Component parentComponent, String message, String windowTitle)
display Error Message
displayMessage(parentComponent, message, windowTitle, JOptionPane.ERROR_MESSAGE);
voiddisplayErrorMessage(final Throwable throwable, final Component parentComponent)
display Error Message
StringWriter stackTrace = new StringWriter();
throwable.printStackTrace(new PrintWriter(stackTrace));
JTextArea textArea = new JTextArea(stackTrace.toString(), 25, 100);
textArea.setEditable(false);
textArea.setTabSize(4);
textArea.setForeground(Color.RED);
textArea.setFont(textArea.getFont().deriveFont(12f));
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(parentComponent), new JScrollPane(textArea),
...
voiddisplayErrorMessage(String msg, Throwable t)
display Error Message
JOptionPane.showMessageDialog(getFrontWindow(), msg, "Database Error", JOptionPane.ERROR_MESSAGE);
voiddisplayErrors(Component parent, List errors)
display Errors
StringBuilder sb = new StringBuilder();
for (String error : errors)
    sb.append(" - " + error + "\n");
JOptionPane.showMessageDialog(parent, sb.toString(), "Invalid Input", JOptionPane.ERROR_MESSAGE);
voiderrMsg(Component owner, String msg, Exception e)
show an error message and print a stack trace to the console if in development mode (DEV_MODE = true)
if (msg != null) {
    JOptionPane.showMessageDialog(owner, msg, ERR_TITLE, JOptionPane.ERROR_MESSAGE);
if (e != null) {
    e.printStackTrace();
voiderrMsg(final Component owner, final String msg, final Throwable e)
show an error message and print a stack trace to the console if in development mode (DEV_MODE = true)
if (e != null) {
    e.printStackTrace();
if (msg != null) {
    JOptionPane.showMessageDialog(owner, msg, ERR_TITLE, JOptionPane.ERROR_MESSAGE);
voiderrMsg(final String msg)
Error message dialog
SwingUtilities.invokeLater(new Runnable() {
    public void run() {
        JOptionPane.showMessageDialog(null, msg, "Error", JOptionPane.ERROR_MESSAGE);
        System.out.println(msg);
});
voiderrMsg(String msg)
Error message dialog
JOptionPane.showMessageDialog(null, msg, "Error", JOptionPane.ERROR_MESSAGE);
System.out.println(msg);
voiderror(Component comp, String title, String message, Object[] args)
Displays an error dialog box.
JOptionPane.showMessageDialog(comp, message, title, JOptionPane.ERROR_MESSAGE);
voiderror(Component parent, Exception e)
error
e.printStackTrace();
error(parent, e.toString());