code: static void showErrorMessage(Exception e, Component parent) {
      String msg = e.getMessage();
      JOptionPane.showMessageDialog(parent, msg, "Error", JOptionPane.ERROR_MESSAGE);
      e.printStackTrace();
    }
docs: Show the exception (message without stacktrace) in a dialog and print the
  stacktrace to STDERR.