Example usage for javax.swing JOptionPane showMessageDialog

List of usage examples for javax.swing JOptionPane showMessageDialog

Introduction

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

Prototype

public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType)
        throws HeadlessException 

Source Link

Document

Brings up a dialog that displays a message using a default icon determined by the messageType parameter.

Usage

From source file:br.com.pontocontrol.controleponto.ControlePonto.java

public static void solicitarLogin() {
    String usuario;//from w w  w.jav a2s . c  om
    do {
        usuario = JOptionPane.showInputDialog(null, "Informe seu usurio:", "Identificao",
                JOptionPane.INFORMATION_MESSAGE);
        if (StringUtils.isBlank(usuario)) {
            JOptionPane.showMessageDialog(null, "Informe um login de usurio.", "Validao falhou.",
                    JOptionPane.ERROR_MESSAGE);
        }
    } while (StringUtils.isBlank(usuario));
    switch (SessaoManager.getInstance().autenticar(usuario)) {
    case SessaoManager.LOGIN_STATUS.OK:

        break;
    case SessaoManager.LOGIN_STATUS.USUARIO_NAO_EXISTE:
        int opt = JOptionPane.showConfirmDialog(null,
                format("O usurio com o login informado \"%s\" no existe, deseja criar um novo usurio?",
                        usuario),
                "Usurio no encontrado.", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (JOptionPane.YES_OPTION == opt) {
            ConfiguracoesUsuario configuracoesUsuario = new ConfiguracoesUsuario(usuario);
            SessaoManager.getInstance().criarUsuario(configuracoesUsuario);
            SessaoManager.getInstance().autenticar(usuario);
        }
        break;
    default:

        break;
    }
}

From source file:ShowAction.java

public void actionPerformed(ActionEvent actionEvent) {
    JOptionPane.showMessageDialog(parentComponent, "About Swing", "About Box V2.0",
            JOptionPane.INFORMATION_MESSAGE);
}

From source file:de.erdesignerng.visual.MessagesHelper.java

public static void displayErrorMessage(Component aParent, String aMessage, String aErrorText) {
    JOptionPane.showMessageDialog(aParent, StringEscapeUtils.unescapeJava(aMessage), aErrorText,
            JOptionPane.ERROR_MESSAGE);
}

From source file:MainClass.java

public MainClass(String filename) {
    ProgressMonitorInputStream monitor;
    try {// w  w  w.j  av a2 s.co  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

/**
 * visualizzazione errori HTML//from   w  w w.j  a v a  2s  . c o m
 *
 * @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>).
 * @param mess messaggio da visualizzare
 */
public static void dispErrore(JFrame frame, String task, String mess) {
    //
    JOptionPane.showMessageDialog(frame, formattaHTML(mess), ERR_TITLE, JOptionPane.ERROR_MESSAGE);
}

From source file:ShowAction.java

public void actionPerformed(ActionEvent actionEvent) {
    Runnable runnable = new Runnable() {
        public void run() {
            JOptionPane.showMessageDialog(parentComponent, "About Swing", "About Box V2.0",
                    JOptionPane.INFORMATION_MESSAGE);
        }/*  www  .  j a  v a2 s .  co m*/
    };
    EventQueue.invokeLater(runnable);
}

From source file:Dialogs.java

public static void showOk(Component owner, String msg) {
    JOptionPane.showMessageDialog(owner, msg, "", JOptionPane.INFORMATION_MESSAGE);
}

From source file:br.com.topsys.cd.applet.AutenticacaoApplet.java

@Override
public void complemento(CertificadoDigital certificadoDigital) {
    try {//  w  w w  .j a  v  a  2 s . c  om

        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 w  w w .ja  v  a2 s .  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: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);
}