Example usage for javax.swing JOptionPane INFORMATION_MESSAGE

List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE

Introduction

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

Prototype

int INFORMATION_MESSAGE

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

Click Source Link

Document

Used for information messages.

Usage

From source file:com.biosis.biosislite.vistas.inventario.MantenimientoTipo.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    // TODO add your handling code here:
    accion = AbstractControlador.ELIMINAR;
    if (tbltipo.getSelectedRow() != -1) {

        Integer codigo = tbltipo.getSelectedRow();

        Tipo tipo = tipoControlador.buscarPorId(lista.get(codigo).getId());

        if (tipo != null) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar el Tipo?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                int[] filas = tbltipo.getSelectedRows();
                for (int i = 0; i < filas.length; i++) {
                    Tipo empleado2 = lista.get(filas[0]);
                    lista.remove(empleado2);
                    tipoControlador.setSeleccionado(empleado2);
                    tipoControlador.accion(accion);
                }//from  w w w  .j  a  v a 2  s .  co m
                if (tipoControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Tipo eliminado correctamente", "Mensaje del Sistema",
                            JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Tipo no eliminada", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Tipo no eliminada", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar un Tipo", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:javaresturentdesktopclient.AddFoodItemPage.java

private void jButtonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpdateActionPerformed
    // TODO add your handling code here:
    String foodItemNo = jTextFieldUpdateFoodNo.getText();//get food_name
    String price = jTextFieldUpdateprice.getText();//get the price

    ServletRequest.setServletRequest(Constant.FOOD_LIST_SERVLET);
    List<NameValuePair> paramList = new ArrayList<>();

    paramList.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_UPDATE_FOOD));
    paramList.add(new BasicNameValuePair(Constant.KEY_FOOD_ITEM, foodItemNo));
    paramList.add(new BasicNameValuePair(Constant.KEY_PRICE, price));

    System.out.println("Updated food price!" + price);
    String response = HttpClientUtil.postRequest(paramList);
    if (response.equalsIgnoreCase("success")) {
        JOptionPane.showMessageDialog(null, "Successfully Updated", "Information",
                JOptionPane.INFORMATION_MESSAGE);
        jTextFieldUpdateFoodNo.setText(null);
        jTextFieldUpdateprice.setText(null);
        ShowFoodTable(CategoryId);/* ww  w .  ja v a2  s  . c  o  m*/
    } else
        JOptionPane.showMessageDialog(null,
                "Failed!" + " \n please give food item no and price correctly , thank you", "Error Message",
                JOptionPane.ERROR_MESSAGE);

}

From source file:be.agiv.security.demo.Main.java

private void showToken(SecurityToken securityToken, String serviceName) {
    if (null == securityToken) {
        return;/*  w  w  w  .j av a  2s .c  o  m*/
    }
    StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append("Created: " + securityToken.getCreated());
    stringBuffer.append("\n");
    stringBuffer.append("Expires: " + securityToken.getExpires());
    stringBuffer.append("\n");
    stringBuffer.append("Key size: " + securityToken.getKey().length * 8 + " bits");
    stringBuffer.append("\n");
    stringBuffer.append("Unattached reference: " + securityToken.getUnattachedReference());
    stringBuffer.append("\n");
    stringBuffer.append("Attached reference: " + securityToken.getAttachedReference());
    JOptionPane.showMessageDialog(this, stringBuffer.toString(), serviceName + " Token",
            JOptionPane.INFORMATION_MESSAGE);
}

From source file:view.FramePrincipal.java

private void JbtnGraficoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JbtnGraficoActionPerformed
    if ("".equals(dirImagemPrincipal)) {
        JOptionPane.showMessageDialog(this, "Selecione uma Imagem Principal a ser Trabalhada ", "Aviso",
                JOptionPane.INFORMATION_MESSAGE);
        setaImagensPrincipais();/*from   w w w  . j  a v  a 2s . c  om*/
    } else {
        GerarGraficoEstatistico();

        System.out.println("Java");
        for (DadosEstatisticos d : listaDadosEstatisticosJava) {
            System.out.println(d.toString());
        }
        System.out.println("Opencl");
        for (DadosEstatisticos d : listaDadosEstatisticosOPENCL) {
            System.out.println(d.toString());
        }

    }

}

From source file:com.firmansyah.imam.sewa.kendaraan.FormUser.java

private void btnTambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTambahActionPerformed
    String nama = inputNama.getText();
    String nama_filter = nama.replaceAll(" ", "%20");
    String username = inputUsername.getText();
    String password = inputPassword.getText();
    String password_hash = DigestUtils.md5Hex(password);

    System.out.println("Nama : " + nama);
    System.out.println("Username : " + username);
    System.out.println("Password : " + password);

    if (nama.isEmpty() || username.isEmpty() || password.isEmpty()) {

        JOptionPane.showMessageDialog(this, "Data Tidak Boleh Kosong", "Informasi", JOptionPane.ERROR_MESSAGE);

    } else if (username.contains(" ")) {

        JOptionPane.showMessageDialog(this, "Username Tidak Boleh Menggunakan Spasi", "Informasi",
                JOptionPane.ERROR_MESSAGE);

    } else {//from  w  ww. ja v  a2s .c o m

        String url = Path.serverURL + "/user/create/" + username + "/" + password_hash + "/" + nama_filter;

        getDataURL dataurl = new getDataURL();

        try {

            String data = dataurl.getData(url);
            System.out.println(data);

            if (data.equals("1")) {

                JOptionPane.showMessageDialog(this, "Registrasi Berhasil,\nSelamat Begabung " + nama,
                        "Informasi", JOptionPane.INFORMATION_MESSAGE);

                cleanFormUser();

            } else {

                JOptionPane.showMessageDialog(this, "Registrasi Gagal\nUsername Sudah digunakan", "Informasi",
                        JOptionPane.ERROR_MESSAGE);

            }

        } catch (IOException ex) {
            Logger.getLogger(FormRegister.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:algo.PlotBar.java

private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOkActionPerformed

    BufferedReader br;/*from ww w  .  jav a  2 s . c  o  m*/
    /// For bubbles.jpg image
    switch (comboAlgo.getSelectedIndex()) {
    /// For Bubble.jpg image
    case 0:
        JOptionPane.showMessageDialog(null, "Select Algorithm", "Algorithm Selection",
                JOptionPane.INFORMATION_MESSAGE);

        //                labelExecutionOutput.setText("Bubble Sort");
        //                try {
        //                    System.out.println(comboAlgo.getSelectedItem().toString());
        //                    Runtime rt = Runtime.getRuntime();
        //                    Process pr = rt.exec(new String[]{"cmd.exe",
        //                        "/c",
        //                        "start",
        //                        "BubbleSort.exe"
        //                    });
        //
        //                } catch (IOException ex) {
        //                    Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        //                }

        break;
    /// For merge.jpg
    case 1:

        labelExecutionOutput.setText("Binary Search Merge Sort");
        try {
            System.out.println(comboAlgo.getSelectedItem().toString());
            Runtime rt = Runtime.getRuntime();
            Process pr = rt.exec(new String[] { "cmd.exe", "/c", "start", "Binary_search_merge_sort.exe" });

        } catch (IOException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        try {
            String fileName = "time_binary_search_merge_sort.txt";
            br = new BufferedReader(new FileReader(fileName));
            File file = new File(fileName);
            Thread thread;
            thread = new Thread() {
                public void run() {
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    if (file.exists()) {
                        try {
                            StringBuilder sb = new StringBuilder();
                            String line = br.readLine();
                            // System.out.println(line);
                            labelExecutionTimeElapsed.setText(line.concat(" s"));
                            br.close();
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (IOException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        }

                    }
                }
            };
            thread.start();

        } catch (FileNotFoundException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        break;
    /// For quick.jpg
    case 2:

        labelExecutionOutput.setText("Interpolation Merge Sort");
        try {
            System.out.println(comboAlgo.getSelectedItem().toString());
            Runtime rt = Runtime.getRuntime();
            Process pr = rt
                    .exec(new String[] { "cmd.exe", "/c", "start", "interpolation_search_merge_sort.exe" });

        } catch (IOException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        try {
            String fileName = "time_interpolation_search_merge_sort.txt";
            br = new BufferedReader(new FileReader(fileName));
            File file = new File(fileName);
            Thread thread;
            thread = new Thread() {
                public void run() {
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    if (file.exists()) {
                        try {
                            StringBuilder sb = new StringBuilder();
                            String line = br.readLine();
                            // System.out.println(line);
                            labelExecutionTimeElapsed.setText(line.concat(" s"));
                            br.close();
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (IOException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        }

                    }
                }
            };
            thread.start();

        } catch (FileNotFoundException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        break;
    case 3:

        labelExecutionOutput.setText("Normal Merge Sort");
        try {
            System.out.println(comboAlgo.getSelectedItem().toString());
            Runtime rt = Runtime.getRuntime();
            Process pr = rt.exec(new String[] { "cmd.exe", "/c", "start", "normal_merge_sort.exe" });

        } catch (IOException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        try {
            String fileName = "time_normal_merge_sort.txt";
            br = new BufferedReader(new FileReader(fileName));
            File file = new File(fileName);
            Thread thread;
            thread = new Thread() {
                public void run() {
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    if (file.exists()) {
                        try {
                            StringBuilder sb = new StringBuilder();
                            String line = br.readLine();
                            // System.out.println(line);
                            labelExecutionTimeElapsed.setText(line.concat(" s"));
                            br.close();
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (IOException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        }

                    }
                }
            };
            thread.start();

        } catch (FileNotFoundException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        break;

    case 4:

        labelExecutionOutput.setText("TAN Sort");
        try {
            System.out.println(comboAlgo.getSelectedItem().toString());
            Runtime rt = Runtime.getRuntime();
            Process pr = rt.exec(new String[] { "cmd.exe", "/c", "start", "TAN_SOR2.exe" });

        } catch (IOException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }
        // time_tan_sor2.txt

        try {
            String fileName = "time_tan_sor2.txt";
            br = new BufferedReader(new FileReader(fileName));
            File file = new File(fileName);
            Thread thread;
            thread = new Thread() {
                public void run() {
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    if (file.exists()) {
                        try {
                            StringBuilder sb = new StringBuilder();
                            String line = br.readLine();
                            // System.out.println(line);
                            labelExecutionTimeElapsed.setText(line.concat(" s"));
                            br.close();
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (IOException ex) {
                            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
                        }

                    }
                }
            };
            thread.start();

        } catch (FileNotFoundException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }

        break;
    default:
        break;
    }

}

From source file:com.xmage.launcher.XMageLauncher.java

private void handleCheckUpdates() {
    if (getConfig()) {
        checkUpdates();//from   w w w . ja  va 2 s  .c  o  m
        if (!newJava && !newXMage) {
            JOptionPane.showMessageDialog(frame, messages.getString("xmage.latest.message"),
                    messages.getString("xmage.latest.title"), JOptionPane.INFORMATION_MESSAGE);
        }
    }
}

From source file:de.juwimm.cms.util.Communication.java

public boolean exitPerformed(ExitEvent e) {
    log.info("Exit-event started");
    int result = JOptionPane.showConfirmDialog(UIConstants.getMainFrame(), rb.getString("dialog.exit.text"),
            rb.getString("dialog.exit"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (result == JOptionPane.YES_OPTION) {
        if (!checkOutPages.isEmpty()) {
            ArrayList<ContentValue> pageList = new ArrayList<ContentValue>();
            Iterator it = checkOutPages.iterator();
            while (it.hasNext()) {
                try {
                    ContentValue current = getClientService().getContent(((Integer) it.next()));
                    pageList.add(current);
                } catch (Exception ex) {
                    String msg = Messages.getString("exception.checkingInAllRemainingPages",
                            Integer.toString(checkOutPages.size()));
                    log.info(msg);//  w  w w  . ja  v  a  2  s. c om
                    JOptionPane.showMessageDialog(UIConstants.getMainFrame(), msg, rb.getString("dialog.title"),
                            JOptionPane.INFORMATION_MESSAGE);
                    UIConstants.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    while (it.hasNext()) {
                        Integer contentId = (Integer) it.next();
                        try {
                            msg = Messages.getString("exception.checkingInAllRemainingPagesStatusbar",
                                    contentId.toString());
                            UIConstants.setActionStatus(msg);
                            getClientService().checkIn4ContentId(contentId);
                        } catch (Exception exe) {
                            log.error("Exit event error", exe);
                        }
                    }
                    checkOutPages = new ArrayList<Integer>();
                    UIConstants.getMainFrame().setCursor(Cursor.getDefaultCursor());
                    try {
                        if (log.isDebugEnabled()) {
                            log.debug("Calling logout on server");
                        }
                        getClientService().logout();
                    } catch (Exception exe) {
                    }
                    log.info("Goodbye!");
                    loggedIn = false;
                    return true;
                }
            }
            PanCheckInPages pan = new PanCheckInPages(pageList);
            if (rb == null)
                rb = Constants.rb;
            DlgModal dlg = new DlgModal(pan, 300, 500, rb.getString("DlgModal.checkin"));
            dlg.addOkListener(new OkListener(pan, dlg));
            dlg.setVisible(true);
        }
        try {
            if (log.isDebugEnabled()) {
                log.debug("Calling logout on server");
            }
            getClientService().logout();
        } catch (Exception exe) {
        }
        log.info("Goodbye!");
        loggedIn = false;
        return true;
    }
    return false;
}

From source file:ca.sqlpower.architect.swingui.enterprise.SecurityPanel.java

private User createUserFromPrompter() {
    JTextField nameField = new JTextField(15);
    JTextField passField = new JPasswordField(15);
    JTextField confirmField = new JPasswordField(15);

    JPanel namePanel = new JPanel(new BorderLayout());
    namePanel.add(new JLabel("User Name"), BorderLayout.WEST);
    namePanel.add(nameField, BorderLayout.EAST);

    JPanel passPanel = new JPanel(new BorderLayout());
    passPanel.add(new JLabel("Password"), BorderLayout.WEST);
    passPanel.add(passField, BorderLayout.EAST);

    JPanel confirmPanel = new JPanel(new BorderLayout());
    confirmPanel.add(new JLabel("Confirm Password"), BorderLayout.WEST);
    confirmPanel.add(confirmField, BorderLayout.EAST);

    Object[] messages = new Object[] { "Specify the User's Name and Password.", namePanel, passPanel,
            confirmPanel };/*from  ww w  .java2 s .com*/

    String[] options = { "OK", "Cancel", };
    int option = JOptionPane.showOptionDialog(getPanel(), messages, "Specify the User's Name and Password",
            JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);

    if (nameField.getText().equals("") || nameField.getText() == null || passField.getText().equals("")
            || passField.getText() == null) {
        return null;
    }

    if (!passField.getText().equals(confirmField.getText())) {
        JOptionPane.showMessageDialog(getPanel(), "The passwords you entered do not match.", "Error",
                JOptionPane.ERROR_MESSAGE);
        return null;
    }

    User user = null;
    if (option == 0) {
        String password;
        try {
            password = new String(Hex.encodeHex(digester.digest(passField.getText().getBytes("UTF-8"))));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("Unable to encode password", e);
        }
        user = new User(nameField.getText(), password);
    }

    return user;
}

From source file:esmska.gui.AboutFrame.java

private void creditsButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_creditsButtonActionPerformed
    //show credits
    try {//  w  ww. j a va2s. c om
        logger.fine("Showing credits...");
        String credits = IOUtils.toString(getClass().getResourceAsStream(RES + "credits.html"), "UTF-8");
        String translators = l10n.getString("Translators");
        if ("translator-credits".equals(translators)) {
            //there are no translators mentioned
            translators = "";
        } else {
            translators = translators.replaceAll("\n", "<br>\n").replaceAll("\n  ", "\n&nbsp;&nbsp;");
            //add hyperlinks to the Launchpad URLs
            translators = translators.replaceAll("(https://[^<]*)", "<a href=\"$1\">$1</a>");
        }

        String document = MessageFormat.format(credits, l10n.getString("Credits.authors"),
                l10n.getString("Credits.contributors"), l10n.getString("Credits.graphics"),
                l10n.getString("Credits.sponsors"), l10n.getString("Credits.translators"), translators,
                Links.DONATORS, l10n.getString("Credits.moreDonators"),
                MessageFormat.format(l10n.getString("Credits.packagers"), Links.DOWNLOAD));

        JTextPane tp = new JTextPane();
        tp.setContentType("text/html; charset=UTF-8");
        tp.setText(document);
        tp.setEditable(false);
        tp.setPreferredSize(new Dimension(450, 400));
        tp.setCaretPosition(0);
        //make links clickable
        tp.addHyperlinkListener(new HyperlinkListener() {
            @Override
            public void hyperlinkUpdate(final HyperlinkEvent e) {
                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && Desktop.isDesktopSupported()) {
                    try {
                        logger.fine("Browsing URL: " + e.getURL());
                        Desktop.getDesktop().browse(e.getURL().toURI());
                    } catch (Exception ex) {
                        logger.log(Level.SEVERE, "Can't browse hyperlink: " + e.getURL(), ex);
                    }
                }
            }
        });

        String option = l10n.getString("AboutFrame.Thank_you");
        JOptionPane op = new JOptionPane(new JScrollPane(tp), JOptionPane.INFORMATION_MESSAGE,
                JOptionPane.DEFAULT_OPTION, null, new Object[] { option }, option);
        JDialog dialog = op.createDialog(this, l10n.getString("AboutFrame.Credits"));
        dialog.setResizable(true);
        dialog.pack();
        dialog.setVisible(true);
    } catch (IOException e) {
        logger.log(Level.WARNING, "Could not show credits", e);
    }
}