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:kevin.gvmsgarch.App.java

private static boolean areYouSure(Worker.ArchiveMode mode, Worker.ListLocation location, ContactFilter filter) {
    String message = "Are you sure you want to " + mode.toPrettyString() + " your messages from "
            + location.toString() + "\nfiltered by " + filter.toString() + "?";
    String warning;//from  w  w w.  j  a v a 2  s .  c  o  m
    if ((warning = mode.getWarning()) != null) {
        message += "\n\n" + warning;
    }
    return JOptionPane.showConfirmDialog(null, message, "Really really sure?", JOptionPane.YES_NO_OPTION,
            JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION;
}

From source file:edu.ku.brc.specify.config.init.RegisterSpecify.java

/**
 * @param regNumber/*from w ww . j  a  v  a  2s  .  com*/
 * @param isAnonymous
 */
private void setCollectionHasRegistered(final String regNumber, final boolean isAnonymous) {
    Collection collection = AppContextMgr.getInstance().getClassObject(Collection.class);
    collection = DataModelObjBase.getDataObj(Collection.class, collection.getId());

    collection.setRegNumber(regNumber);
    update(Collection.class, collection);

    if (!isFirstReg && !isAnonymous()) {
        UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "SpReg.REG_TITLE", "SpReg.REG_OK");
    }
}

From source file:br.usp.poli.lta.cereda.wsn2spa.Editor.java

private void showMessage(String title, String message) {
    String html = String.format("<html><body style=\"width:250px\">%s</body></html>", message);
    JOptionPane.showMessageDialog(this, html, title, JOptionPane.INFORMATION_MESSAGE);
}

From source file:edu.harvard.i2b2.explorer.serviceClient.PDOQueryClient.java

public static String sendPDOQueryRequestREST(String XMLstr) {
    try {/*from   w w  w  .j av a  2 s  .  c  o  m*/

        SAXBuilder parser = new SAXBuilder();
        String xmlContent = XMLstr;
        java.io.StringReader xmlStringReader = new java.io.StringReader(xmlContent);
        org.jdom.Document tableDoc = parser.build(xmlStringReader);
        XMLOutputter o = new XMLOutputter();
        o.setFormat(Format.getPrettyFormat());
        StringWriter str = new StringWriter();
        o.output(tableDoc, str);
        //jMessageTextArea.setText(str.toString());
        //text.setText(str.toString());

        MessageUtil.getInstance().setRequest("URL: " + getPDOServiceName() + "\n" + str);
        OMElement payload = getQueryPayLoad(XMLstr);
        Options options = new Options();

        targetEPR = new EndpointReference(getPDOServiceName());
        options.setTo(targetEPR);

        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
        options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(600000));
        options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(600000));

        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);

        OMElement responseElement = sender.sendReceive(payload);
        // log.debug("Client Side response " + responseElement.toString());
        xmlStringReader = new java.io.StringReader(responseElement.toString());
        tableDoc = parser.build(xmlStringReader);
        o = new XMLOutputter();
        o.setFormat(Format.getPrettyFormat());
        str = new StringWriter();
        o.output(tableDoc, str);
        MessageUtil.getInstance().setResponse("URL: " + getPDOServiceName() + "\n" + str); //responseElement.toString());

        return responseElement.toString();

    } catch (AxisFault axisFault) {
        axisFault.printStackTrace();
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JOptionPane.showMessageDialog(null,
                        "Trouble with connection to the remote server, "
                                + "this is often a network error, please try again",
                        "Network Error", JOptionPane.INFORMATION_MESSAGE);
            }
        });

        return null;
    } catch (java.lang.OutOfMemoryError e) {
        e.printStackTrace();
        return "memory error";
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:edu.ku.brc.services.biogeomancer.GeoCoordBGMProvider.java

public void processGeoRefData(final List<GeoCoordDataIFace> items,
        final GeoCoordProviderListenerIFace listenerArg, final String helpContextArg) {
    this.listener = listenerArg;
    this.helpContext = helpContextArg;

    UsageTracker.incrUsageCount("Tools.BioGeomancerData"); //$NON-NLS-1$

    log.info("Performing BioGeomancer lookup of selected records"); //$NON-NLS-1$

    // create a progress bar dialog to show the network progress
    final ProgressDialog progressDialog = new ProgressDialog(
            UIRegistry.getResourceString("GeoCoordBGMProvider.BIOGEOMANCER_PROGRESS"), false, true); // I18N //$NON-NLS-1$
    progressDialog.getCloseBtn().setText(getResourceString("CANCEL")); //$NON-NLS-1$
    progressDialog.setModal(true);// w ww  .j  ava2s. c o  m
    progressDialog.setProcess(0, items.size());

    // XXX Java 6
    //progressDialog.setIconImage( IconManager.getImage("AppIcon").getImage());

    // use a SwingWorker thread to do all of the work, and update the GUI when done
    final SwingWorker bgTask = new SwingWorker() {
        final JStatusBar statusBar = UIRegistry.getStatusBar();
        protected boolean cancelled = false;

        @Override
        public void interrupt() {
            super.interrupt();
            cancelled = true;
        }

        @SuppressWarnings("synthetic-access") //$NON-NLS-1$
        @Override
        public Object construct() {
            // perform the BG web service call ON all rows, storing results in the rows

            int progress = 0;

            for (GeoCoordDataIFace item : items) {
                if (cancelled) {
                    break;
                }

                // get the locality data
                String localityNameStr = item.getLocalityString();

                // get the geography data
                String country = item.getCountry();
                String state = item.getState();
                String county = item.getCounty();

                log.info("Making call to BioGeomancer service: " + localityNameStr); //$NON-NLS-1$
                String bgResults;
                BioGeomancerQuerySummaryStruct bgQuerySummary;
                try {
                    bgResults = BioGeomancer.getBioGeomancerResponse(item.getGeoCoordId().toString(), country,
                            state, county, localityNameStr);
                    bgQuerySummary = BioGeomancer.parseBioGeomancerResponse(bgResults);
                } catch (IOException ex1) {
                    String warning = getResourceString("GeoCoordBGMProvider.WB_BIOGEOMANCER_UNAVAILABLE"); //$NON-NLS-1$
                    statusBar.setWarningMessage(warning, ex1);
                    log.error("A network error occurred while contacting the BioGeomancer service", ex1); //$NON-NLS-1$

                    // update the progress bar UI and move on
                    progressDialog.setProcess(++progress);
                    continue;
                } catch (Exception ex2) {
                    UsageTracker.incrHandledUsageCount();
                    edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(GeoCoordBGMProvider.class,
                            ex2);
                    // right now we'll simply blame this on BG
                    // in the future we might get more specific about this error
                    String warning = getResourceString("GeoCoordBGMProvider.WB_BIOGEOMANCER_UNAVAILABLE"); //$NON-NLS-1$
                    statusBar.setWarningMessage(warning, ex2);
                    log.warn("Failed to get result count from BioGeomancer respsonse", ex2); //$NON-NLS-1$

                    // update the progress bar UI and move on
                    progressDialog.setProcess(++progress);
                    continue;
                }

                // if there was at least one result, pre-cache a map for that result
                int resCount = bgQuerySummary.results.length;
                if (resCount > 0) {
                    final int rowNumber = item.getGeoCoordId();
                    final BioGeomancerQuerySummaryStruct summaryStruct = bgQuerySummary;
                    // create a thread to go grab the map so it will be cached for later use
                    Thread t = new Thread(new Runnable() {
                        public void run() {
                            try {
                                log.info("Requesting map of BioGeomancer results for workbench row " //$NON-NLS-1$
                                        + rowNumber);
                                BioGeomancer.getMapOfQuerySummary(summaryStruct, null);
                            } catch (Exception e) {
                                UsageTracker.incrHandledUsageCount();
                                edu.ku.brc.exceptions.ExceptionTracker.getInstance()
                                        .capture(GeoCoordBGMProvider.class, e);
                                log.warn("Failed to pre-cache BioGeomancer results map", e); //$NON-NLS-1$
                            }
                        }
                    });
                    t.setName("Map Pre-Caching Thread: row " + item.getGeoCoordId()); // I18N //$NON-NLS-1$
                    log.debug("Starting map pre-caching thread"); //$NON-NLS-1$
                    t.start();
                }

                // if we got at least one result...
                if (resCount > 0) {
                    item.setXML(bgResults);
                }

                // update the progress bar UI and move on
                progressDialog.setProcess(++progress);
            }

            return null;
        }

        @Override
        public void finished() {
            statusBar.setText(getResourceString("GeoCoordBGMProvider.BIOGEOMANCER_COMPLETED")); //$NON-NLS-1$

            if (!cancelled) {
                // hide the progress dialog
                progressDialog.setVisible(false);

                // find out how many records actually had results
                List<GeoCoordDataIFace> rowsWithResults = new Vector<GeoCoordDataIFace>();
                for (GeoCoordDataIFace row : items) {
                    if (row.getXML() != null) {
                        rowsWithResults.add(row);
                    }
                }

                // if no records had possible results...
                int numRecordsWithResults = rowsWithResults.size();
                if (numRecordsWithResults == 0) {
                    statusBar.setText(getResourceString("GeoCoordBGMProvider.NO_BG_RESULTS")); //$NON-NLS-1$
                    JOptionPane.showMessageDialog(UIRegistry.getTopWindow(),
                            getResourceString("GeoCoordBGMProvider.NO_BG_RESULTS"),
                            getResourceString("NO_RESULTS"), JOptionPane.INFORMATION_MESSAGE);
                    return;
                }

                if (listener != null) {
                    listener.aboutToDisplayResults();
                }

                // ask the user if they want to review the results
                String message = String.format(
                        getResourceString("GeoCoordBGMProvider.BGM_VIEW_RESULTS_CONFIRM"), //$NON-NLS-1$
                        String.valueOf(numRecordsWithResults));
                int userChoice = JOptionPane.showConfirmDialog(UIRegistry.getTopWindow(), message,
                        getResourceString("GeoCoordBGMProvider.CONTINUE"), JOptionPane.YES_NO_OPTION);//$NON-NLS-1$

                if (userChoice != JOptionPane.YES_OPTION) {
                    statusBar.setText(getResourceString("GeoCoordBGMProvider.BIOGEOMANCER_TERMINATED")); //$NON-NLS-1$
                    return;
                }

                displayBioGeomancerResults(rowsWithResults);
            }
        }
    };

    // if the user hits close, stop the worker thread
    progressDialog.getCloseBtn().addActionListener(new ActionListener() {
        @SuppressWarnings("synthetic-access") //$NON-NLS-1$
        public void actionPerformed(ActionEvent ae) {
            log.debug("Stopping the BioGeomancer service worker thread"); //$NON-NLS-1$
            bgTask.interrupt();
        }
    });

    log.debug("Starting the BioGeomancer service worker thread"); //$NON-NLS-1$
    bgTask.start();
    UIHelper.centerAndShow(progressDialog);
}

From source file:com.iucosoft.eavertizare.gui.ConfiguratiJDialog.java

private void jButtonSaveConfiguratiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveConfiguratiActionPerformed
    getDataConfiguratii();/*www.java  2s  .  co m*/
    String word = "";
    if (configuratii.getId() < 1) { //save
        configuratiiDao.save(configuratii);
        word = "adaugata";
    } else {// update
        configuratiiDao.update(configuratii);
        word = "editata";
    }
    JOptionPane.showMessageDialog(this, "Configuratie " + word + " cu success", "Info",
            JOptionPane.INFORMATION_MESSAGE);

    parent.sincronizare();
    parent.refreshFrame();
    this.dispose();
}

From source file:au.org.ala.delta.intkey.ui.FindInTaxaDialog.java

@Action
public void findTaxa() {
    String searchText = _textField.getText();
    boolean searchSynonyms = _chckbxSearchSynonyms.isSelected();
    boolean searchEliminatedTaxa = _chckbxSearchEliminatedTaxa.isSelected();
    if (!StringUtils.isEmpty(searchText)) {
        _numMatchedTaxa = _intkeyApp.findTaxa(searchText, searchSynonyms, searchEliminatedTaxa);
        this.setTitle(MessageFormat.format(windowTitleNumberFound, _numMatchedTaxa));

        if (_numMatchedTaxa > 0) {
            _currentMatchedTaxon = 0;/*from   ww w.j  a v  a  2s .  c o m*/
            taxonSelectionUpdated();
        } else {
            JOptionPane.showMessageDialog(this, noTaxaFoundMessage, "", JOptionPane.INFORMATION_MESSAGE);
        }
    }
}

From source file:biz.wolschon.finance.jgnucash.JGnucash.java

/**
 * @return a menu-item to show a report on plugin-loading
 *//*w w w .  j  a va  2  s. co m*/
private JMenuItem getHelpPluginReportMenu() {
    if (helpPluginReport == null) {
        helpPluginReport = new JMenuItem();
        helpPluginReport.setText("Plugin Report");
        helpPluginReport.addActionListener(new ActionListener() {

            @SuppressWarnings("unchecked")
            @Override
            public void actionPerformed(final ActionEvent e) {
                PluginManager manager = getPluginManager();
                IntegrityCheckReport report = manager.getRegistry().getRegistrationReport();
                StringBuilder message = new StringBuilder();
                Collection<IntegrityCheckReport.ReportItem> items = report.getItems();
                for (IntegrityCheckReport.ReportItem reportItem : items) {
                    String severity = ""; /*unknown: ";
                                          if (reportItem.getSeverity() == IntegrityCheckReport.ReportItem.SEVERITY_ERROR) {
                                          severity = "Error: ";
                                          } else if (reportItem.getSeverity() == IntegrityCheckReport.ReportItem.SEVERITY_WARNING) {
                                          severity = "Warning: ";
                                          } else if (reportItem.getSeverity() == IntegrityCheckReport.ReportItem.SEVERITY_INFO) {
                                          severity = "Info: ";
                                          };*/
                    message.append(severity)
                            /*.append('(')
                            .append(reportItem.getCode())
                            .append(')')*/
                            .append(reportItem.getMessage()).append('\n');
                }
                JOptionPane.showMessageDialog(JGnucash.this, message.toString(), "Plugins-Report",
                        JOptionPane.INFORMATION_MESSAGE);
            }
        });
    }
    return helpPluginReport;
}

From source file:metodosnumericos.VentanaReglaFalsa.java

private void butCalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCalcularActionPerformed
    if (txtIteraciones.getText().isEmpty() || txtTolerancia.getText().isEmpty() || txtXi.getText().isEmpty()
            || txtXs.getText().isEmpty()) {
        JOptionPane.showMessageDialog(null, "Verifique que los campos no esten vacios", "Mensaje",
                JOptionPane.INFORMATION_MESSAGE);
    } else {//from   w  w w  . ja v  a 2  s.c  o m
        try {
            Graficador t = new Graficador();
            double tolerancia = Double.parseDouble(txtTolerancia.getText());
            int iteraciones = Integer.parseInt(txtIteraciones.getText());
            double xi = Double.parseDouble(txtXi.getText());
            double xs = Double.parseDouble(txtXs.getText());

            ChartPanel panel = t.series(funcion, xi, xs);
            panelGrafica.removeAll();
            panelGrafica.add(panel);
            panelGrafica.updateUI();

            Metodos m = new Metodos();
            JOptionPane.showMessageDialog(null, m.ReglaFalsa(xs, xi, tolerancia, iteraciones, funcion, true),
                    "Resultado", JOptionPane.INFORMATION_MESSAGE);

            GeneradorTablas g = new GeneradorTablas();
            JTable tabla = g.tablaBiseccion(m.getReglaFalsaXi(), m.getReglaFalsaXs(), m.getReglaFalsaXm(),
                    m.getReglaFalsaFxm(), m.getReglaFalsaEa(), m.getReglaFalsaEr());

            panelTabla.removeAll();
            panelTabla.add(new JScrollPane(tabla));
            panelTabla.updateUI();

            VentanaUnaVariable vuv = new VentanaUnaVariable();

            System.out.println("Mire se encontro: " + funcion);
            Evaluador eva = new Evaluador();
            eva.Evaluador2(funcion, 2);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Verifique que los campos sean Numeros", "Mensaje",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    }

}

From source file:net.sf.keystore_explorer.gui.actions.ExportKeyPairPrivateKeyAction.java

private void exportAsOpenSsl(PrivateKey privateKey, String alias) throws CryptoException, IOException {
    File exportFile = null;//from   ww w  .java 2s .  co  m

    try {
        DExportPrivateKeyOpenSsl dExportPrivateKeyOpenSsl = new DExportPrivateKeyOpenSsl(frame, alias,
                applicationSettings.getPasswordQualityConfig());
        dExportPrivateKeyOpenSsl.setLocationRelativeTo(frame);
        dExportPrivateKeyOpenSsl.setVisible(true);

        if (!dExportPrivateKeyOpenSsl.exportSelected()) {
            return;
        }

        exportFile = dExportPrivateKeyOpenSsl.getExportFile();
        boolean pemEncode = dExportPrivateKeyOpenSsl.pemEncode();
        boolean encrypt = dExportPrivateKeyOpenSsl.encrypt();

        OpenSslPbeType pbeAlgorithm = null;
        Password exportPassword = null;

        if (encrypt) {
            pbeAlgorithm = dExportPrivateKeyOpenSsl.getPbeAlgorithm();
            exportPassword = dExportPrivateKeyOpenSsl.getExportPassword();
        }

        byte[] encoded = getOpenSslEncodedPrivateKey(privateKey, pemEncode, pbeAlgorithm, exportPassword);

        exportEncodedPrivateKey(encoded, exportFile);

        JOptionPane.showMessageDialog(frame,
                res.getString("ExportKeyPairPrivateKeyAction.ExportPrivateKeyOpenSslSuccessful.message"),
                res.getString("ExportKeyPairPrivateKeyAction.ExportPrivateKeyOpenSsl.Title"),
                JOptionPane.INFORMATION_MESSAGE);
    } catch (FileNotFoundException ex) {
        String message = MessageFormat
                .format(res.getString("ExportKeyPairPrivateKeyAction.NoWriteFile.message"), exportFile);
        JOptionPane.showMessageDialog(frame, message,
                res.getString("ExportKeyPairPrivateKeyAction.ExportPrivateKeyOpenSsl.Title"),
                JOptionPane.WARNING_MESSAGE);
    }
}