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.MantenimientoCampo.java

private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    String palabra2 = "";
    if (accion == 1) {
        palabra = "registrar";
        palabra2 = "registrado";

        if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Campo?", "Mensaje del Sistema",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

            campoControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase());
            campoControlador.getSeleccionado().setClase((Clase) cmbClase.getSelectedItem());
            //                campoControlador.getSeleccionado().setUnidadMedida((UnidadMedida) cmbUnidad.getSelectedItem());

            campoControlador.accion(accion);
            lista.add(campoControlador.getSeleccionado());

            if (accion == 1) {
                JOptionPane.showMessageDialog(null, "Campo " + palabra2 + " correctamente",
                        "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);
                FormularioUtil.limpiarComponente(panelDatos);
            } else {
                JOptionPane.showMessageDialog(null, "Campo no " + palabra2, "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }//from   www. j a v a  2s.  co m
        } else {
            FormularioUtil.limpiarComponente(panelDatos);
            JOptionPane.showMessageDialog(null, "Campo no " + palabra2, "Mensaje del Sistema",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else if (accion == 2) {
        palabra = "modificar";
        palabra2 = "modificado";

        if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Campo?", "Mensaje del Sistema",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

            if (accion == 2) {
                JOptionPane.showMessageDialog(null, "Campo " + palabra2 + " correctamente",
                        "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);

                lista.clear();

                campoControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase());
                campoControlador.getSeleccionado().setClase((Clase) cmbClase.getSelectedItem());
                //                    campoControlador.getSeleccionado().setUnidadMedida((UnidadMedida) cmbUnidad.getSelectedItem());

                campoControlador.accion(accion);
                listar();

                FormularioUtil.limpiarComponente(panelDatos);

            } else {
                JOptionPane.showMessageDialog(null, "Campo no " + palabra2, "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        } else {
            FormularioUtil.limpiarComponente(panelDatos);
            JOptionPane.showMessageDialog(null, "Campo no " + palabra2, "Mensaje del Sistema",
                    JOptionPane.ERROR_MESSAGE);
        }
    }

    FormularioUtil.activarComponente(panelOpciones, true);
    FormularioUtil.activarComponente(panelGuardar, false);
    FormularioUtil.activarComponente(panelDatos, false);

}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.AngleDirectController.java

/**
 * @param pdfFile//from   w  w  w. j a  va 2 s. c  o m
 */
private void tryToCreateFile(File pdfFile, JFreeChart chart) {
    try {
        boolean success = pdfFile.createNewFile();
        if (success) {
            singleCellPreProcessingController.showMessage("Chart saved to file!", "chart saved OK",
                    JOptionPane.INFORMATION_MESSAGE);
        } else {
            Object[] options = { "Yes", "No", "Cancel" };
            int showOptionDialog = JOptionPane.showOptionDialog(null,
                    "File already exists. Do you want to replace it?", "", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE, null, options, options[2]);
            // if YES, user wants to delete existing file and replace it
            if (showOptionDialog == 0) {
                boolean delete = pdfFile.delete();
                if (!delete) {
                    return;
                }
                // if NO, returns already existing file
            } else if (showOptionDialog == 1) {
                return;
            }
        }
    } catch (IOException ex) {
        singleCellPreProcessingController.showMessage("Unexpected error: " + ex.getMessage() + ".",
                "Unexpected error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    try (FileOutputStream fileOutputStream = new FileOutputStream(pdfFile)) {
        // actually create PDF file
        createPdfFile(fileOutputStream, chart);
    } catch (IOException ex) {
        singleCellPreProcessingController.showMessage("Unexpected error: " + ex.getMessage() + ".",
                "Unexpected error", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:jeplus.gui.EPlusEditorPanel.java

public void validateJSON(final String json) {
    boolean valid = false;
    String msg = null;/*from  ww w .j a  v  a  2  s  .  co  m*/
    try {
        final JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(json);
        while (parser.nextToken() != null) {
        }
        valid = true;
    } catch (JsonParseException jpe) {
        msg = jpe.getLocalizedMessage();
    } catch (IOException ioe) {
        msg = ioe.getLocalizedMessage();
    }
    if (!valid) {
        JOptionPane.showMessageDialog(this, "<html><p>JSON contents is not valid. Please check:</p><p>" + msg,
                "Success", JOptionPane.ERROR_MESSAGE);
    } else {
        JOptionPane.showMessageDialog(this, "JSON contents is valid!", "Success",
                JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.edit.UpdateOntologyDialog.java

public Thread processStatus(ProgressBar bar, Label updateStatus, Button ok, Button background,
        String operationType, boolean includeHiddens) {
    final ProgressBar theBar = bar;
    final Label theStatus = updateStatus;
    final Button theOkButton = ok;
    final Button theBackgroundButton = background;
    final Display theDisplay = Display.getCurrent();
    final String theOperation = operationType;
    final boolean hidden = includeHiddens;

    return new Thread() {
        @Override//w ww .  j  a va2  s . co m
        public void run() {
            try {
                synchronize(theOperation, hidden, theDisplay);
                if (this.getName().equals("stop")) {
                    System.gc();
                    return;
                }
                long waitTime = 5000; //  msec
                Thread.sleep(waitTime);

                while (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("PROCESSING")) {
                    if (this.getName().equals("stop")) {
                        System.gc();
                        return;
                    }
                    // need to do something if this fails...
                    getStatus();
                    String step = ProcessStatus.getInstance().getStatus().getProcessStepCd();
                    if (step.equals("ONT_BUILD_PDO_START")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(33);
                                    theStatus.setText("Building data file to upload");
                                }
                            });
                        }
                    } else if (step.equals("ONT_SENTTO_FRC")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(50);
                                    theStatus.setText("Uploading data file to FRC");
                                }
                            });
                        }
                    } else if (step.equals("ONT_SENTTO_CRCLOADER")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(60);
                                    theStatus.setText("Loading data into dimension table");
                                }
                            });
                        }
                    }
                    if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("COMPLETED")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(100);
                                    theStatus.setText("Synchronization complete");
                                }
                            });
                        }
                        break;
                    }
                    if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("ERROR")) {
                        break;
                    }
                    Thread.sleep(waitTime);
                }
                if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("COMPLETED")) {
                    if (!(this.getName().equals("stop"))) {
                        theDisplay.syncExec(new Runnable() {
                            public void run() {
                                theBar.setSelection(100);
                                theStatus.setText("Synchronization complete");
                                if (theOperation.equals("synchronize_all")) {
                                    theOkButton.setEnabled(false);
                                    MetadataRecord.getInstance().getSyncAction()
                                            .setImageDescriptor(ImageDescriptor.createFromFile(EditView.class,
                                                    "/icons/database_refresh.png"));
                                } else {
                                    theOkButton.setEnabled(false);
                                    if ((ProcessStatus.getInstance()
                                            .getDirtyState() == DirtyValueType.DELETE_EDIT))
                                        MetadataRecord.getInstance().getSyncAction().setImageDescriptor(
                                                ImageDescriptor.createFromFile(EditView.class,
                                                        "/icons/red_database_refresh.png"));
                                    else
                                        MetadataRecord.getInstance().getSyncAction().setImageDescriptor(
                                                ImageDescriptor.createFromFile(EditView.class,
                                                        "/icons/database_refresh.png"));
                                }
                                theBackgroundButton.setEnabled(false);
                            }
                        });
                    }
                }
                if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("ERROR")) {
                    final String errorMessage = "Synchronize process is reporting an error";
                    if (!(this.getName().equals("stop"))) {
                        theDisplay.syncExec(new Runnable() {
                            public void run() {
                                theStatus.setText(errorMessage);
                                theOkButton.setEnabled(true);
                                theBackgroundButton.setEnabled(true);
                            }
                        });

                        java.awt.EventQueue.invokeLater(new Runnable() {
                            public void run() {
                                JOptionPane.showMessageDialog(null, errorMessage, "Error",
                                        JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
                    }
                }
            } catch (InterruptedException e) {
                //         log.error(e.getMessage());
                final String errorMessage = "Synchronize process is reporting a communication error.";
                if (!(this.getName().equals("stop"))) {
                    theDisplay.syncExec(new Runnable() {
                        public void run() {
                            theStatus.setText(errorMessage);
                            theOkButton.setEnabled(true);
                            theBackgroundButton.setEnabled(true);
                        }
                    });
                    java.awt.EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            JOptionPane.showMessageDialog(null, errorMessage, "Error",
                                    JOptionPane.INFORMATION_MESSAGE);
                        }
                    });
                }

            } catch (Exception e) {
                if (!(this.getName().equals("stop"))) {
                    final String errorMessage = "Synchronize process is reporting an error";
                    theDisplay.syncExec(new Runnable() {
                        public void run() {
                            theStatus.setText(errorMessage);
                            theOkButton.setEnabled(true);
                            theBackgroundButton.setEnabled(true);
                        }
                    });
                    java.awt.EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            JOptionPane.showMessageDialog(null, errorMessage, "Error",
                                    JOptionPane.INFORMATION_MESSAGE);
                        }
                    });
                }
            } finally {
                //   interrupt();

            }

        }
    };
}

From source file:com.compomics.cell_coord.gui.controller.load.LoadTracksController.java

/**
 * Load the data files into the tree./* w  ww  . ja  va2 s.  c  o m*/
 *
 * @throws LoadDirectoryException - when the directory is empty!
 */
private void loadDataIntoTree() throws LoadDirectoryException {
    DefaultTreeModel model = (DefaultTreeModel) loadTracksPanel.getDirectoryTree().getModel();
    DefaultMutableTreeNode rootNote = (DefaultMutableTreeNode) model.getRoot();
    // change name (user object) of root node
    rootNote.setUserObject(directory.getName());
    File[] listFiles = directory.listFiles();
    if (listFiles.length != 0) {
        for (File file : listFiles) {
            if (!file.isDirectory()) {
                DefaultMutableTreeNode fileNode = new DefaultMutableTreeNode(file.getName(), Boolean.FALSE);
                rootNote.add(fileNode);
            } else {
                // reset the directory to null
                directory = null;
                throw new LoadDirectoryException("This directory has a wrong structure!");
            }
        }
    } else {
        // reset the directory to null
        directory = null;
        throw new LoadDirectoryException("This directory seems to be empty!");
    }
    model.reload();
    loadTracksPanel.getChosenDirectoryTextArea().setText(directory.getAbsolutePath());
    cellCoordController.showMessage("Directory successful loaded!\nYou can now select the files to import!", "",
            JOptionPane.INFORMATION_MESSAGE);
    loadTracksPanel.getImportFilesButton().setEnabled(true);
}

From source file:com.diversityarrays.kdxplore.curate.TraitsAndInstancesPanel2.java

private void showContextMenu(MouseEvent me) {

    Map<SimpleStatistics<?>, TraitInstance> tiByStat = new HashMap<>();

    List<SimpleStatistics<?>> statsList = new ArrayList<>();
    List<TraitInstance> selectedInstances = new ArrayList<>();

    Set<Integer> rowSet = new HashSet<>();

    for (int row : traitInstanceStatsTable.getSelectedRows()) {
        rowSet.add(row);//  w w w .j  ava  2 s  .  c o m
    }

    // Include the right-click one too
    int row = traitInstanceStatsTable.rowAtPoint(me.getPoint());
    if (row >= 0) {
        rowSet.add(row);
    }

    List<Integer> vrows = new ArrayList<>(rowSet);
    Collections.sort(vrows);
    for (Integer vrow : vrows) {
        collectInfoFromRow(vrow, selectedInstances, tiByStat, statsList);
    }

    List<TraitInstance> checkedInstances = tiStatsModel.getCheckedTraitInstances();

    Action action = null;
    if (!statsList.isEmpty()) {
        String label = statsList.size() == 1 ? "Show Outliers"
                : "Show Outliers for " + statsList.size() + " Traits";
        action = new AbstractAction(label) {
            @Override
            public void actionPerformed(ActionEvent e) {
                StringBuilder html = new StringBuilder();
                html.append("<HTML><TABLE><TR>");

                outlierSelections.clear();

                for (SimpleStatistics<?> stat : statsList) {
                    html.append("<TH>");
                    html.append(StringUtil.htmlEscape(stat.getStatsName()));
                    html.append("</TH>");
                }

                html.append("</TR><TR>");

                for (SimpleStatistics<?> stat : statsList) {
                    TraitInstance ti = tiByStat.get(stat);
                    html.append("<TD valign='top'>");
                    describeStats(stat, html, ti);
                    html.append("</TD>");

                    outlierSelections.add(createOutlierSelection(stat, ti));
                }
                html.append("</TR></TABLE>");

                outlierConsumer.accept(outlierSelections);

                JOptionPane.showMessageDialog(TraitsAndInstancesPanel2.this, html.toString(), "Outliers",
                        JOptionPane.INFORMATION_MESSAGE);

            }
        };
    }

    curationMenuProvider.showTraitInstanceTableToolMenu(me, checkedInstances, selectedInstances, action);
}

From source file:javaresturentdesktopclient.BillingPage.java

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    // TODO add your handling code here:

    try {//from w ww .  j  a  v a2  s .  c o m
        Document doc = new Document(PageSize.A4.rotate());
        String Datee = Date;
        PdfWriter.getInstance(doc,
                new FileOutputStream("d:/BillingTable_" + transactionId + "_" + Datee + ".pdf"));

        PdfPTable pdfTable = new PdfPTable(jTableMealOrder.getColumnCount());
        //adding table headers
        for (int i = 0; i < jTableMealOrder.getColumnCount(); i++) {
            pdfTable.addCell(jTableMealOrder.getColumnName(i));
        }
        //extracting data from the JTable and inserting it to PdfPTable
        for (int rows = 0; rows < jTableMealOrder.getRowCount(); rows++) {
            for (int cols = 0; cols < jTableMealOrder.getColumnCount(); cols++) {
                pdfTable.addCell(jTableMealOrder.getModel().getValueAt(rows, cols).toString());

            }
        }

        doc.open();

        Paragraph preface = new Paragraph("Biliing Id :  " + transactionId
                + "                                                                                                                                  DATE : "
                + Date + "  TIME :" + Time + "\n\n\n\n");
        preface.setAlignment(Element.ALIGN_LEFT);
        doc.add(preface);
        pdfTable.setHorizontalAlignment(Element.ALIGN_CENTER);
        doc.add(pdfTable);

        Paragraph preface1 = new Paragraph("\n\n\n\n\tTotal:" + Total + "\n\n");
        preface1.setAlignment(Element.ALIGN_BASELINE);
        doc.add(preface1);
        doc.add(new Paragraph());

        doc.add(new Paragraph("\n\n\n\nTHANK YOU"));

        doc.close();
        System.out.println("done");
        JOptionPane.showMessageDialog(null, "Printed", "Information", JOptionPane.INFORMATION_MESSAGE);
    } catch (DocumentException ex) {
        Logger.getLogger(BillingPage.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(BillingPage.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.intuit.tank.tools.script.ScriptFilterRunner.java

/**
 * /*w w w  .  j a  v a2s  .c  o m*/
 */
protected void displayXml() {
    if (tankScript != null) {
        xmlViewDialog.setTitle(tankScript.getName());
        String xml = toXml(tankScript);
        xmlViewDialog.setText(xml, !xmlViewDialog.isVisible());
        if (!xmlViewDialog.isVisible()) {
            WindowUtil.centerOnParent(xmlViewDialog);
            xmlViewDialog.setVisible(true);
        }
    } else {
        JOptionPane.showMessageDialog(this, "You must select a Tank XML file.", "Data Needed",
                JOptionPane.INFORMATION_MESSAGE);
    }

}

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

private Group createGroupFromPrompter() {
    Object input = JOptionPane.showInputDialog(getPanel(), "Enter a name for the group.",
            "Enter the name of the group.", JOptionPane.INFORMATION_MESSAGE);
    if (input != null && !input.equals("")) {
        return new Group((String) input);
    } else {//from  w w  w . jav a 2  s.  c  om
        return null;
    }
}

From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java

/**
 *
 * @return Create the menu that allows load the result from others
 * experiments.//from  www .ja v a 2  s .c o  m
 */
private JMenu createMenu() {

    final JMenu fileMenu = new JMenu("Options");

    final JFileChooser f = new JFileChooser();
    f.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    fileMenu.add("Add report file or directory").addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (curveOptions != null) {
                curveOptions.setVisible(false);
                curveOptions = null;
            }
            int action = f.showOpenDialog(fileMenu);

            if (action == JFileChooser.APPROVE_OPTION) {

                loadReportFile(f.getSelectedFile());

            }

        }
    });

    fileMenu.add("Area under learning curve (ALC)").addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            if (comboBox.getItemCount() != 0) {

                if (!comboBox.getSelectedItem().toString().isEmpty()) {

                    StringBuilder st = new StringBuilder();

                    st.append("Measure: ").append(comboBox.getSelectedItem()).append("\n\n");

                    for (int query = 0; query < queryNames.size(); query++) {

                        double value = LearningCurveUtility.getArea(evaluationsCollection.get(query),
                                comboBox.getSelectedItem().toString());

                        String valueString = String.format("%.3f", value);

                        st.append(queryNames.get(query)).append(": ").append(valueString).append("\n");

                    }

                    JOptionPane.showMessageDialog(content, st.toString(), "Area under the learning curve",
                            JOptionPane.INFORMATION_MESSAGE);
                }
            }
        }
    });

    fileMenu.add("Clear").addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            queryNames = new ArrayList<String>();
            evaluationsCollection = new ArrayList<List<AbstractEvaluation>>();
            comboBox.removeAllItems();
            controlCurveColor = new HashMap<String, Color>();
            colors.clear();
            data = null;
            set.clear();
            curveOptions.setVisible(false);
            curveOptions = null;
            setSeries.clear();
            passiveEvaluation = null;

        }
    });

    fileMenu.add("Curve options").addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            data = informationTable();

            if (queryNames.isEmpty()) {
                JOptionPane.showMessageDialog(null, "Please add curves");
                return;
            }
            if (curveOptions == null) {
                curveOptions = new LearningCurvesVisualTable(ExternalBasicChart.this);
            } else {
                curveOptions.setVisible(true);
            }

        }

    });

    final JCheckBox viewPoints = new JCheckBox("View points's shapes");
    viewPoints.setSelected(false);

    viewPoints.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            viewPointsForm = viewPoints.isSelected();
            jComboBoxItemStateChanged();
        }
    });

    fileMenu.add(viewPoints);

    final JCheckBox withOutColor = new JCheckBox("View without color");
    withOutColor.setSelected(false);

    withOutColor.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            viewWithOutColor = withOutColor.isSelected();
            jComboBoxItemStateChanged();
        }
    });

    fileMenu.add(withOutColor);

    return fileMenu;
}