Example usage for javax.swing JOptionPane ERROR_MESSAGE

List of usage examples for javax.swing JOptionPane ERROR_MESSAGE

Introduction

In this page you can find the example usage for javax.swing JOptionPane ERROR_MESSAGE.

Prototype

int ERROR_MESSAGE

To view the source code for javax.swing JOptionPane ERROR_MESSAGE.

Click Source Link

Document

Used for error messages.

Usage

From source file:Main.java

public static void showErrorDialog(Component parentComponent, String message) {
    JOptionPane.showMessageDialog(parentComponent, message, "Error", JOptionPane.ERROR_MESSAGE);
}

From source file:Main.java

public static void error(Component parent, String message, String title) {
    JOptionPane.showMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
}

From source file:Main.java

/** Show an error message dialog box with message word wrapping. */
public static void errorMessageBox(Component parent, String message) {
    messageBox(parent, "Error", JOptionPane.ERROR_MESSAGE, message);
}

From source file:Main.java

/**
 * Displays an error-message.//  ww w.j a  v  a 2s . c o m
 * 
 * @param parent the parent <code>Component</code>
 * @param message the message to display
 */
public static void displayError(Component parent, String message) {
    JOptionPane.showMessageDialog(parent, message, null, JOptionPane.ERROR_MESSAGE);
}

From source file:Main.java

public static void showErrorMessage(Component parentComponent, String mensagem, Throwable t) {
    String errorMessage = t.toString();
    JOptionPane.showMessageDialog(parentComponent, mensagem + "\n" + errorMessage, "Erro",
            JOptionPane.ERROR_MESSAGE);
}

From source file:com._17od.upm.gui.MainWindow.java

public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {

            try {
                // Use the System look and feel
                Preferences.load();
                Translator.initialise();
                Double jvmVersion = new Double(System.getProperty("java.specification.version"));
                if (jvmVersion.doubleValue() < 1.4) {
                    JOptionPane.showMessageDialog(null, Translator.translate("requireJava14"),
                            Translator.translate("problem"), JOptionPane.ERROR_MESSAGE);
                    System.exit(1);
                } else {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    AppWindow = new MainWindow(applicationName);
                }/*from  w w  w  .j a  v  a2  s  .  c  o m*/

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:com.adito.server.Main.java

/**
 * Entry point/* w ww  . j  av a2s . co  m*/
 * 
 * @param args
 * @throws Throwable
 */
public static void main(String[] args) throws Throwable {

    // This is a hack to allow the Install4J installer to get the java
    // runtime that will be used
    if (args.length > 0 && args[0].equals("--jvmdir")) {
        System.out.println(SystemProperties.get("java.home"));
        System.exit(0);
    }
    useWrapper = System.getProperty("wrapper.key") != null;
    final Main main = new Main();
    ContextHolder.setContext(main);

    if (useWrapper) {
        WrapperManager.start(main, args);
    } else {
        Integer returnCode = main.start(args);
        if (returnCode != null) {
            if (main.gui) {
                if (main.startupException == null) {
                    main.startupException = new Exception("An exit code of " + returnCode + " was returned.");
                }
                try {
                    if (SystemProperties.get("os.name").toLowerCase().startsWith("windows")) {
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    }
                } catch (Exception e) {
                }
                String mesg = main.startupException.getMessage() == null ? "No message supplied."
                        : main.startupException.getMessage();
                StringBuffer buf = new StringBuffer();
                int l = 0;
                char ch = ' ';
                for (int i = 0; i < mesg.length(); i++) {
                    ch = mesg.charAt(i);
                    if (l > 50 && ch == ' ') {
                        buf.append("\n");
                        l = 0;
                    } else {
                        if (ch == '\n') {
                            l = 0;
                        } else {
                            l++;
                        }
                        buf.append(ch);
                    }
                }
                mesg = buf.toString();
                final String fMesg = mesg;
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        JOptionPane.showMessageDialog(null, fMesg, "Startup Error", JOptionPane.ERROR_MESSAGE);
                    }
                });
            }
            System.exit(returnCode.intValue());
        } else {
            Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    if (!main.shuttingDown) {
                        main.stop(0);
                    }
                }
            });
        }
    }
}

From source file:Main.java

/**
 * Show an alert window./* w ww  . ja v a2 s.  c  o  m*/
 * @param message   The message to show.
 * @param parent   Parent component of this dialog.
 */
public static void error(String message, Component parent) {
    Toolkit.getDefaultToolkit().beep();
    JOptionPane.showMessageDialog(parent, message, "Alert", JOptionPane.ERROR_MESSAGE);
}

From source file:latexstudio.editor.remote.DbxUtil.java

public static DbxClient getDbxClient() {
    String accessToken = (String) ApplicationSettings.Setting.DROPBOX_TOKEN.getValue();
    if (accessToken == null) {
        JOptionPane.showMessageDialog(null,
                "The authentication token has not been set.\n"
                        + "Please connect the application to your Dropbox account first!",
                "Dropbox authentication token not found", JOptionPane.ERROR_MESSAGE);
        return null;
    }/*w  w  w.  ja v  a  2  s .  c om*/
    return new DbxClient(getDbxConfig(), accessToken);
}

From source file:guiTool.Helper.java

public static final boolean checkInternet() {

    try {/*from  w  w w  . ja  va2  s. c  o  m*/
        Socket socket = new Socket();
        InetSocketAddress add = new InetSocketAddress("www.google.com", 80);
        socket.connect(add, 3000);
        return true;
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "The server or your internet connection could be down.",
                "connection test", JOptionPane.ERROR_MESSAGE);
        return false;
    }

}