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.clough.android.adbv.view.UpdateTableDialog.java

private void applyChangesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyChangesButtonActionPerformed
    // TODO add your handling code here:
    List<Row> rowsToInsert = rowController.getRowsToInsert();
    List<Row> rowsToUpdate = rowController.getRowsToUpdate();
    List<Row> rowsToDelete = rowController.getRowsToDelete();
    int insertCount = rowsToInsert.size();
    int updateCount = rowsToUpdate.size();
    int deleteCount = rowsToDelete.size();
    if (insertCount > 0 || updateCount > 0 || deleteCount > 0) {
        String message = "Inserting row count " + insertCount + "\n" + "Updating row count " + updateCount
                + "\n" + "Deleting row count " + deleteCount + "\n"
                + "Are you sure you want apply this changes?";
        if (JOptionPane.showConfirmDialog(null, message, "Applying changes",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            mainFrame.setTableChangeList(rowsToChange, rowsToInsert, rowsToUpdate, rowsToDelete);
            dispose();/*from   w  w w .  j  av  a  2s . c  om*/
        }
    } else {
        JOptionPane.showMessageDialog(null, "No changes to apply", "Applying changes",
                JOptionPane.INFORMATION_MESSAGE);
        dispose();
    }
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDoseResponseController.java

/**
 * Ask user to choose for a directory and invoke swing worker for creating
 * PDF report/*from   w w  w .  ja v a 2 s .c  om*/
 *
 * @throws IOException
 */
protected void createPdfReport() throws IOException {
    Experiment experiment = areaMainController.getExperiment();
    // choose directory to save pdf file
    JFileChooser chooseDirectory = new JFileChooser();
    chooseDirectory.setDialogTitle("Choose a directory to save the report");
    chooseDirectory.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    chooseDirectory.setSelectedFile(new File("Dose Response Report " + experiment.toString() + " - "
            + experiment.getProject().toString() + ".pdf"));
    // in response to the button click, show open dialog
    int returnVal = chooseDirectory.showSaveDialog(areaMainController.getDataAnalysisPanel());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File directory = chooseDirectory.getCurrentDirectory();
        DoseResponseReportSwingWorker doseResponseReportSwingWorker = new DoseResponseReportSwingWorker(
                directory, chooseDirectory.getSelectedFile().getName());
        doseResponseReportSwingWorker.execute();
    } else {
        areaMainController.showMessage("Open command cancelled by user", "", JOptionPane.INFORMATION_MESSAGE);
    }
}

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

/**
 * Do action./*  ww  w  . j  a  v a2 s  .  co m*/
 */
@Override
protected void doAction() {
    FileOutputStream fos = null;
    File caReplyFile = null;

    try {
        KeyStoreHistory history = kseFrame.getActiveKeyStoreHistory();
        KeyStoreState currentState = history.getCurrentState();

        String alias = kseFrame.getSelectedEntryAlias();

        Password password = getEntryPassword(alias, currentState);

        if (password == null) {
            return;
        }

        KeyStore keyStore = currentState.getKeyStore();

        PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias, password.toCharArray());
        Certificate[] certs = keyStore.getCertificateChain(alias);

        KeyPairType keyPairType = KeyPairUtil.getKeyPairType(privateKey);

        File csrFile = chooseCsrFile();
        if (csrFile == null) {
            return;
        }

        PKCS10CertificationRequest pkcs10Csr = null;
        Spkac spkacCsr = null;

        try {
            CryptoFileType fileType = CryptoFileUtil.detectFileType(new FileInputStream(csrFile));
            if (fileType == CryptoFileType.PKCS10_CSR) {
                pkcs10Csr = Pkcs10Util.loadCsr(new FileInputStream(csrFile));

                if (!Pkcs10Util.verifyCsr(pkcs10Csr)) {
                    JOptionPane.showMessageDialog(frame,
                            res.getString("SignCsrAction.NoVerifyPkcs10Csr.message"),
                            res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
                    return;
                }
            } else if (fileType == CryptoFileType.SPKAC_CSR) {
                spkacCsr = new Spkac(new FileInputStream(csrFile));

                if (!spkacCsr.verify()) {
                    JOptionPane.showMessageDialog(frame,
                            res.getString("SignCsrAction.NoVerifySpkacCsr.message"),
                            res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
                    return;
                }
            } else {
                JOptionPane.showMessageDialog(frame,
                        MessageFormat.format(res.getString("SignCsrAction.FileNotRecognisedType.message"),
                                csrFile),
                        res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
                return;
            }
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(frame,
                    MessageFormat.format(res.getString("SignCsrAction.NotFile.message"), csrFile),
                    res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
            return;
        } catch (Exception ex) {
            String problemStr = MessageFormat.format(res.getString("SignCsrAction.NoOpenCsr.Problem"),
                    csrFile.getName());

            String[] causes = new String[] { res.getString("SignCsrAction.NotCsr.Cause"),
                    res.getString("SignCsrAction.CorruptedCsr.Cause") };

            Problem problem = new Problem(problemStr, causes, ex);

            DProblem dProblem = new DProblem(frame, res.getString("SignCsrAction.ProblemOpeningCsr.Title"),
                    problem);
            dProblem.setLocationRelativeTo(frame);
            dProblem.setVisible(true);

            return;
        }

        X509Certificate[] signingChain = X509CertUtil
                .orderX509CertChain(X509CertUtil.convertCertificates(certs));
        X509Certificate signingCert = signingChain[0];

        PublicKey publicKey = null;
        X500Name subject = null;
        DSignCsr dSignCsr = null;
        Provider provider = history.getExplicitProvider();

        if (pkcs10Csr != null) {
            publicKey = new JcaPKCS10CertificationRequest(pkcs10Csr).getPublicKey();
            subject = pkcs10Csr.getSubject();

            dSignCsr = new DSignCsr(frame, pkcs10Csr, csrFile, privateKey, keyPairType, signingCert, provider);
        } else {
            publicKey = spkacCsr.getPublicKey();
            subject = spkacCsr.getSubject().getName();

            dSignCsr = new DSignCsr(frame, spkacCsr, csrFile, privateKey, keyPairType, signingCert, provider);
        }

        dSignCsr.setLocationRelativeTo(frame);
        dSignCsr.setVisible(true);

        X509CertificateVersion version = dSignCsr.getVersion();
        SignatureType signatureType = dSignCsr.getSignatureType();
        long validityPeriod = dSignCsr.getValidityPeriod();
        BigInteger serialNumber = dSignCsr.getSerialNumber();
        caReplyFile = dSignCsr.getCaReplyFile();
        X509ExtensionSet extensions = dSignCsr.getExtensions();

        if (version == null) {
            return;
        }

        X500Name issuer = X500NameUtils.x500PrincipalToX500Name(signingCert.getSubjectX500Principal());

        // CA Reply is a cert with subject from CSR and issuer from signing cert's subject
        X509CertificateGenerator generator = new X509CertificateGenerator(version);
        X509Certificate caReplyCert = generator.generate(subject, issuer, validityPeriod, publicKey, privateKey,
                signatureType, serialNumber, extensions, provider);

        X509Certificate[] caReplyChain = new X509Certificate[signingChain.length + 1];

        caReplyChain[0] = caReplyCert;

        // Add all of the signing chain to the reply
        System.arraycopy(signingChain, 0, caReplyChain, 1, signingChain.length);

        byte[] caCertEncoded = X509CertUtil.getCertsEncodedPkcs7(caReplyChain);

        fos = new FileOutputStream(caReplyFile);
        fos.write(caCertEncoded);
    } catch (FileNotFoundException ex) {
        JOptionPane.showMessageDialog(frame,
                MessageFormat.format(res.getString("SignJarAction.NoWriteFile.message"), caReplyFile),
                res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.WARNING_MESSAGE);
        return;
    } catch (Exception ex) {
        DError.displayError(frame, ex);
        return;
    } finally {
        IOUtils.closeQuietly(fos);
    }

    JOptionPane.showMessageDialog(frame, res.getString("SignCsrAction.SignCsrSuccessful.message"),
            res.getString("SignCsrAction.SignCsr.Title"), JOptionPane.INFORMATION_MESSAGE);
}

From source file:com.openbravo.pos.sales.JRetailTicketPreviewTicket.java

private void showMessage(JRetailTicketPreviewTicket aThis, String msg, Color colour) {
    JOptionPane.showMessageDialog(aThis, getLabelPanel(msg, colour), "Message",
            JOptionPane.INFORMATION_MESSAGE);

}

From source file:io.heming.accountbook.ui.MainFrame.java

private void importRecords() {
    final JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.addChoosableFileFilter(new AbbFileFilter());
    chooser.setAcceptAllFileFilterUsed(false);
    int value = chooser.showOpenDialog(this);
    if (value == JFileChooser.APPROVE_OPTION) {
        // ?/*w  w  w. j  av  a 2 s .c  om*/
        disableAllControls();
        new Thread() {
            @Override
            public void run() {
                try {
                    statusLabel.setIcon(new ImageIcon(getClass().getResource("loader.gif")));
                    setStatusText("?...");
                    FacadeUtil.shutdown();
                    File file = chooser.getSelectedFile();
                    setStatusText("??...");
                    FileUtils.cleanDirectory(new File(Constants.DATA_DIR));
                    setStatusText("??...");
                    ZIPUtil.decompress(file, new File(Constants.HOME_DIR));
                    setStatusText("?...");
                    FacadeUtil.restart();
                    // ??
                    setStatusText("????...");
                    categories = categoryFacade.listBySale();
                    // ????
                    setStatusText("?...");
                    searchRecords();
                    enableAllControls();
                    setStatusText("");
                    statusLabel.setIcon(new ImageIcon(getClass().getResource("stopped-loader.png")));
                    JOptionPane.showMessageDialog(MainFrame.this, "???", "?",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(MainFrame.this, e.getMessage(), "",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        }.start();
    }
}

From source file:ca.osmcanada.osvuploadr.JPMain.java

public String GetOSMUser() throws IOException {
    final OAuth10aService service = new ServiceBuilder().apiKey(API_KEY).apiSecret(API_SECRET)
            .build(OSMApi.instance());/*from   w ww .jav  a2  s  .c om*/

    final OAuth1RequestToken requestToken = service.getRequestToken();
    String url = service.getAuthorizationUrl(requestToken);
    Helper.OpenBrowser(java.net.URI.create(url));
    //java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
    String pin_code = JOptionPane.showInputDialog(null,
            new String(r.getString("auth_window_opened").getBytes(), "UTF-8"),
            new String(r.getString("auth_required").getBytes(), "UTF-8"), JOptionPane.INFORMATION_MESSAGE);
    final OAuth1AccessToken accessToken = service.getAccessToken(requestToken, pin_code);
    //final OAuthRequest request = new OAuthRequest(Verb.GET, BASE_URL + "api/0.6/user/details", service);
    //service.signRequest(accessToken, request);
    //Response response = request.send();
    //String body = response.getBody();
    //int indxUserId= body.indexOf("user id=\"");
    //int indxEndUserId = body.indexOf("\"",indxUserId+9);
    //int indxUsername= body.indexOf("display_name=\"");
    //int indxEndUsername = body.indexOf("\"",indxUsername+14);
    //String user_id = body.substring(indxUserId+9,indxEndUserId);
    //String username = body.substring(indxUsername+14,indxEndUsername);

    //return user_id +";"+username;
    return accessToken.getToken() + "|" + accessToken.getTokenSecret();
}

From source file:it.ferogrammer.ui.MainAppFrame.java

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
    JOptionPane op = new JOptionPane();
    op.showMessageDialog(this,
            "Copyright (c) 2016 Enea Parimbelli (https://github.com/eparimbelli/FeroGrammer) - terms of the MIT license apply",
            "FeroGrammer v1.1", JOptionPane.INFORMATION_MESSAGE);
}

From source file:metodosnumericos.VentanaBiseccion.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 {//w  w  w .j  a v a2 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.Biseccion(xs, xi, tolerancia, iteraciones, funcion, true),
                    "Resultado", JOptionPane.INFORMATION_MESSAGE);
            GeneradorTablas g = new GeneradorTablas();
            JTable tabla = g.tablaBiseccion(m.getBiseccionXi(), m.getBiseccionXs(), m.getBiseccionXm(),
                    m.getBiseccionFxm(), m.getBiseccionEa(), m.getBiseccionEr());

            panelTabla.removeAll();
            panelTabla.add(new JScrollPane(tabla));
            panelTabla.updateUI();
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Verifique que los campos sean Numeros", "Mensaje",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    }
}

From source file:com.compomics.colims.client.controller.admin.FastaDbSaveUpdateController.java

@Override
@PostConstruct/* ww w  . j  a  v  a  2s . c o  m*/
public void init() {
    //register to event bus
    eventBus.register(this);

    fastaDbSaveUpdatePanel = fastaDbManagementController.getFastaDbManagementDialog()
            .getFastaDbSaveUpdatePanel();
    headerParseRuleAdditionDialog = new HeaderParseRuleAdditionDialog(
            fastaDbManagementController.getFastaDbManagementDialog(), true);
    taxonomyBindingList = ObservableCollections.observableList(new ArrayList<>());
    taxonomyBindingList.add(TAXONOMY_CV_PARAM_NONE);
    taxonomyBindingList.addAll(cvParamService.findByCvParamByClass(TaxonomyCvParam.class));

    //init binding
    bindingGroup = new BindingGroup();

    JComboBoxBinding taxonomyComboBoxBinding = SwingBindings.createJComboBoxBinding(
            AutoBinding.UpdateStrategy.READ_WRITE, taxonomyBindingList,
            fastaDbSaveUpdatePanel.getTaxomomyComboBox());
    bindingGroup.addBinding(taxonomyComboBoxBinding);

    headerParseRuleBindingList = ObservableCollections.observableList(new ArrayList<>());
    try {
        config = PropertiesUtil.parsePropertiesFile("config/header-parse-rule.properties");
    } catch (IOException | ConfigurationException ex) {
        java.util.logging.Logger.getLogger(FastaDbSaveUpdateController.class.getName()).log(Level.SEVERE, null,
                ex);
    }
    fillHeaderParseRuleComboBox();

    JComboBoxBinding parseRuleComboBoxBinding = SwingBindings.createJComboBoxBinding(
            AutoBinding.UpdateStrategy.READ_WRITE, headerParseRuleBindingList,
            fastaDbSaveUpdatePanel.getHeaderParseRuleComboBox());
    bindingGroup.addBinding(parseRuleComboBoxBinding);

    databaseBindingList = ObservableCollections.observableList(new ArrayList<>());
    Properties allProperties = new Properties();
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    try {
        allProperties.load(loader.getResourceAsStream("config/embl-ebi-database.properties"));
        databaseSet = new TreeSet(allProperties.keySet());
    } catch (IOException ex) {
        java.util.logging.Logger.getLogger(FastaDbSaveUpdateController.class.getName()).log(Level.SEVERE, null,
                ex);
    }

    fillDatabaseComboBox();

    JComboBoxBinding databaseComboBoxBinding = SwingBindings.createJComboBoxBinding(
            AutoBinding.UpdateStrategy.READ_WRITE, databaseBindingList,
            fastaDbSaveUpdatePanel.getDatabaseComboBox());
    bindingGroup.addBinding(databaseComboBoxBinding);
    bindingGroup.bind();

    //init FASTA file selection
    //disable select multiple files
    fastaDbSaveUpdatePanel.getFastaFileChooser().setMultiSelectionEnabled(false);
    //set FASTA file filter
    fastaDbSaveUpdatePanel.getFastaFileChooser().setFileFilter(new FastaFileFilter());

    //add listeners
    fastaDbSaveUpdatePanel.getBrowseTaxonomyButton().addActionListener(e -> {
        List<CvParam> cvParams = cvParamService.findByCvParamByClass(TaxonomyCvParam.class);
        //update the CV param list
        cvParamManagementController.updateDialog("FASTA DB taxonomy", TaxonomyCvParam.class,
                PRESELECTED_ONTOLOGY_NAMESPACES, cvParams);

        cvParamManagementController.showView();
    });

    fastaDbSaveUpdatePanel.getBrowseHeaderParseRuleButtton().addActionListener(l -> {
        headerParseRuleAdditionDialog.getParseRuleTextField().setText("");
        headerParseRuleAdditionDialog.getDescriptionTextField().setText("");
        GuiUtils.centerDialogOnComponent(fastaDbSaveUpdatePanel, headerParseRuleAdditionDialog);
        headerParseRuleAdditionDialog.setVisible(true);
    });

    headerParseRuleAdditionDialog.getSaveParseRuleButton().addActionListener(l -> {
        try {
            config = PropertiesUtil.addProperty(config,
                    headerParseRuleAdditionDialog.getDescriptionTextField().getText(),
                    headerParseRuleAdditionDialog.getParseRuleTextField().getText());
        } catch (ConfigurationException | IOException ex) {
            java.util.logging.Logger.getLogger(FastaDbSaveUpdateController.class.getName()).log(Level.SEVERE,
                    null, ex);
        }
        fillHeaderParseRuleComboBox();
        headerParseRuleAdditionDialog.dispose();
    });

    fastaDbSaveUpdatePanel.getBrowseFastaButton().addActionListener(e -> {
        //in response to the button click, show open dialog
        int returnVal = fastaDbSaveUpdatePanel.getFastaFileChooser().showOpenDialog(fastaDbSaveUpdatePanel);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File fastaFile = fastaDbSaveUpdatePanel.getFastaFileChooser().getSelectedFile();

            //show FASTA file name and path in textfields
            fastaDbSaveUpdatePanel.getFileNameTextField().setText(fastaFile.getName());
            fastaDbSaveUpdatePanel.getFilePathTextField().setText(fastaFile.getAbsolutePath());
        }
    });

    fastaDbSaveUpdatePanel.getSaveOrUpdateButton().addActionListener(e -> {
        //validate FASTA DB
        updateFastaToEdit();
        List<String> validationMessages = GuiUtils.validateEntity(fastaDbToEdit);
        if (validationMessages.isEmpty()) {
            if (fastaDbToEdit.getId() != null) {
                fastaDbToEdit = fastaDbService.merge(fastaDbToEdit);
                fastaDbManagementController.updateFastaDb();
            } else {
                fastaDbService.persist(fastaDbToEdit);
                fastaDbManagementController.addFastaDb(fastaDbToEdit);
            }
            fastaDbSaveUpdatePanel.getNameTextField().setEnabled(false);
            fastaDbSaveUpdatePanel.getSaveOrUpdateButton().setText("update");
            fastaDbSaveUpdatePanel.getFastaDbStateInfoLabel().setText("");

            saveUpdate = true;
            MessageEvent messageEvent = new MessageEvent("Fasta DB store confirmation",
                    "Fasta DB " + fastaDbToEdit.getName() + " was stored successfully!",
                    JOptionPane.INFORMATION_MESSAGE);
            eventBus.post(messageEvent);

            fastaDbManagementController.showOverviewPanel();
        } else {
            MessageEvent messageEvent = new MessageEvent("Validation failure", validationMessages,
                    JOptionPane.WARNING_MESSAGE);
            eventBus.post(messageEvent);
        }
    });

    fastaDbSaveUpdatePanel.getBackButton().addActionListener(e -> {
        if (!saveUpdate) {
            fastaDbManagementController.setSelectedFasta(-1);
        }
        saveUpdate = false;
        fastaDbManagementController.showOverviewPanel();
    });
}

From source file:QueryConnector.java

private static void info(String msg) {
    JOptionPane.showMessageDialog(null, msg, tr("INFO_DIALOG_TITLE"), JOptionPane.INFORMATION_MESSAGE);
}