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:br.com.topsys.cd.applet.AutenticacaoApplet.java

@Override
public void complemento(CertificadoDigital certificadoDigital) {
    try {/*from   w  w  w  . ja v  a2s  .  co m*/

        JSObject window = JSObject.getWindow(this);
        window.call("setCertificado", new Object[] {
                Base64.encodeBase64String(certificadoDigital.getX509Certificado().getEncoded()) });
        this.closeSuccess();

    } catch (ExcecaoCertificado ex) {
        JOptionPane.showMessageDialog(null, ex.getMessage(), "Aviso", JOptionPane.ERROR_MESSAGE);
        this.closeError();
    }

}

From source file:com.GoEuro.paseOperation.ParseObject.java

public static City parseJson(String jsonData) {
    City city = new City();

    try {/*from ww w .j  a  v  a 2s  .  co m*/

        JSONObject obj = new JSONObject(jsonData);
        city.setId(obj.getLong("_id"));
        city.setName(obj.getString("name"));
        city.setType(obj.getString("type"));

        JSONObject obj2 = obj.getJSONObject("geo_position");
        city.setLatitude(obj2.getDouble("latitude"));
        city.setLongitude(obj2.getDouble("longitude"));

    } catch (JSONException ex) {
        System.err.println("ERROR: " + ex.getMessage());
        JOptionPane.showMessageDialog(null, "Error parsing Json Object",
                "Error parsing Json Object: " + ex.getMessage(), JOptionPane.ERROR_MESSAGE);
    }

    return city;
}

From source file:ProgressMonitorInputExample.java

public ProgressMonitorInputExample(String filename) {
    ProgressMonitorInputStream monitor;
    try {/* ww  w  . ja va2 s.  c  o m*/
        monitor = new ProgressMonitorInputStream(null, "Loading " + filename, new FileInputStream(filename));
        while (monitor.available() > 0) {
            byte[] data = new byte[38];
            monitor.read(data);
            System.out.write(data);
        }
    } catch (FileNotFoundException e) {
        JOptionPane.showMessageDialog(null, "Unable to find file: " + filename, "Error",
                JOptionPane.ERROR_MESSAGE);
    } catch (IOException e) {
        ;
    }
}

From source file:Main.java

/**
 * Shows an error dialog.//from  www  .j  a  v  a 2s . co m
 * 
 * <p>This can be called from a different thread from the event dispatch
 * thread, and it will be made thread-safe.</p>
 * 
 * @param component component
 * @param title title
 * @param message message
 */
public static void showError(final Component component, final String title, final String message) {
    if (!SwingUtilities.isEventDispatchThread()) {
        try {
            SwingUtilities.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    showError(component, title, message);
                }
            });
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
        return;
    }

    String newMessage = message.replace(">", "&gt;").replace("<", "&lt;").replace("&", "&amp;");
    newMessage = "<html>" + newMessage;

    JOptionPane.showMessageDialog(component, newMessage, title, JOptionPane.ERROR_MESSAGE);
}

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

public static void showDbxAccessDeniedPrompt() {
    JOptionPane.showMessageDialog(null,
            "The application failed to connect to your Dropbox account.\nThis might mean that "
                    + "your access token is no longer valid or you are not connected to the Internet.",
            "Could not connect to Dropbox", JOptionPane.ERROR_MESSAGE);
}

From source file:Main.java

/**
 * visualizzazione errori HTML - visualizza il messaggio da tabella errori.
 *
 * @param frame frame di provenienza (di solito e' <code>this</code>).
 * @param task task di provenienza dell'errore (di solito e'
 * <code>TASK_NAME</code>)./*ww w .j  a va  2  s .  co m*/
 * @param error codice del messaggio
 * @param mess ulteriori dati da visualizzare
 */
public static void dispErrore(JFrame frame, String task, String error, String mess) {
    //
    JOptionPane.showMessageDialog(frame, componiStringaErrore(error, mess), ERR_TITLE,
            JOptionPane.ERROR_MESSAGE);
}

From source file:Main.java

/**
 * visualizzazione errori HTML - visualizza il messaggio da tabella errori.
 *
 * @param iframe internal frmae di provenienza (di solito e'
 * <code>this</code>).//from   w  ww. jav a  2 s.c om
 * @param task task di provenienza dell'errore (di solito e'
 * <code>TASK_NAME</code>).
 * @param error codice del messaggio
 * @param mess ulteriori dati da visualizzare
 */
public static void dispInternalErrore(JInternalFrame iframe, String task, String error, String mess) {
    //
    JOptionPane.showMessageDialog(iframe, componiStringaErrore(error, mess), ERR_TITLE,
            JOptionPane.ERROR_MESSAGE);
}

From source file:com.o2d.pkayjava.editor.CustomExceptionHandler.java

public static void showErrorDialog() {
    new Thread(new Runnable() {
        public void run() {
            EventQueue.invokeLater(new Runnable() {

                @Override//from   ww w  .  j  a  va  2 s.  c  om
                public void run() {
                    JOptionPane.showMessageDialog(null,
                            "Overlap2D just crashed, see stacktrace in overlog.txt file", "Error",
                            JOptionPane.ERROR_MESSAGE);
                }

            });
        }
    }).start();
}

From source file:Main.java

public static void errorMessage(Exception exceptionMsg, boolean quiet) {

    /**/*from  w  w  w.j av  a2  s . c  o  m*/
     * Display Jpanel Error messages any SQL Errors. Overloads
     * errorMessage(String e)
     */
    Object[] options = { "OK", };

    JOptionPane.showOptionDialog(null, exceptionMsg, messagerHeader, JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE, null, options, options[0]);

    if (!quiet) {
        exceptionMsg.printStackTrace();
    }

    // DatabaseManagerSwing.StatusMessage(READY_STATUS);
}

From source file:com.clank.launcher.swing.SwingHelper.java

public static void browseDir(File file, Component component) {
    try {//from   w  ww  . java 2s  .  c o m
        Desktop.getDesktop().open(file);
    } catch (IOException e) {
        JOptionPane.showMessageDialog(component, _("errors.openDirError", file.getAbsolutePath()),
                _("errorTitle"), JOptionPane.ERROR_MESSAGE);
    }
}