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:de.juwimm.cms.http.AuthenticationStreamSupportingHttpInvokerRequestExecutor.java

@Override
protected void executePostMethod(HttpInvokerClientConfiguration config, HttpClient httpClient,
        PostMethod postMethod) throws IOException {
    HttpClientWrapper.getInstance().setHostConfiguration(super.getHttpClient(),
            new URL(config.getServiceUrl()));
    try {/* w  w  w .jav  a  2 s . co m*/
        super.executePostMethod(config, httpClient, postMethod);
        //if call succeeds 
        isErrorMessageShown = false;
    } catch (IOException e) {
        if ((e instanceof SocketException && e.getMessage().equals("Connection reset"))
                || (e instanceof ConnectException && e.getMessage().equals("Connection refused"))) {
            if (!isErrorMessageShown) {
                isErrorMessageShown = true;
                JOptionPane errorOptionPane = new JOptionPane(
                        Constants.rb.getString("exception.connectionToServerLost"),
                        JOptionPane.INFORMATION_MESSAGE);
                JDialog errorDialogPane = errorOptionPane.createDialog(UIConstants.getMainFrame(),
                        rb.getString("dialog.title"));
                errorDialogPane.setModalityType(ModalityType.MODELESS);
                errorDialogPane.setVisible(true);
                errorDialogPane.setEnabled(true);
                errorDialogPane.addWindowListener(new WindowAdapter() {
                    public void windowDeactivated(WindowEvent e) {
                        if (((JDialog) e.getSource()).isVisible() == false) {
                            isErrorMessageShown = false;
                        }
                    }
                });

            }
            log.error("server is not reachable");
        } else {
            e.printStackTrace();
        }
    }
    System.out.println(postMethod.getResponseHeaders());
}

From source file:com.tiempometa.muestradatos.JMuestraDatos.java

private void setDatabase(File database) {
    ReaderContext.setDatabaseFile(database);
    try {//from   ww  w .j  av  a 2  s.c  o  m
        JdbcConnector.connect(ReaderContext.getDatabaseFile().getAbsolutePath(), null, null);
        JOptionPane.showMessageDialog(this,
                "Se abri exitosamente la base de datos: " + ReaderContext.getDatabaseFile().getName(),
                "Conexin a base de datos", JOptionPane.INFORMATION_MESSAGE);
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e1) {
        JOptionPane.showMessageDialog(this, "Error conectando a la base de datos " + e1.getMessage(),
                "Error de base de datos", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.bwc.ora.OraUtils.java

/**
 * Create the anchor LRP. Does this by creating the LRP model and then adds
 * it to the LRP collections used by the application for storing LRPs for
 * analysis and display//from  ww w.  jav a  2  s  .c o  m
 *
 * @param assisted use fovea finding algorithm or manual click to identify
 *                 fovea
 */
public static void generateAnchorLrp(boolean assisted, JButton buttonToEnable) {
    OCTDisplayPanel octDisplayPanel = OCTDisplayPanel.getInstance();
    LrpSettings lrpSettings = ModelsCollection.getInstance().getLrpSettings();
    DisplaySettings displaySettings = ModelsCollection.getInstance().getDisplaySettings();

    if (assisted) {
        JOptionPane.showMessageDialog(null, "Click and drag a window on the OCT which\n"
                + "contains the foveal pit, some of the vitrious,\n"
                + "and some of the Bruch's membrane and choroid.\n"
                + "ORA will the place a LRP at what it believes is\n" + "the center of the foveal pit.\n" + "\n"
                + "Use the arrow keys to move the LRP if desired after placement.\n"
                + "If any setting are adjusted while in this mode\n"
                + "you'll have to click the mouse on the OCT to regain\n"
                + "the ability to move the LRP with the arrow keys.", "Draw foveal pit window",
                JOptionPane.INFORMATION_MESSAGE);

        //allow the user to select region on screen where fovea should be found
        OctWindowSelector octWindowSelector = ModelsCollection.getInstance().getOctWindowSelector();

        MouseInputAdapter selectorMouseListener = new MouseInputAdapter() {
            Point firstPoint = null;
            Point secondPoint = null;
            Point lastWindowPoint = null;

            @Override
            public void mousePressed(MouseEvent e) {
                Collections.getInstance().getOctDrawnLineCollection().clear();
                Collections.getInstance().getLrpCollection().clearLrps();
                if ((firstPoint = octDisplayPanel.convertPanelPointToOctPoint(e.getPoint())) != null) {
                    octWindowSelector.setDisplay(true);
                    displaySettings.setDisplaySelectorWindow(true);
                }
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                secondPoint = octDisplayPanel.convertPanelPointToOctPoint(e.getPoint());
                octWindowSelector.setDisplay(false);
                displaySettings.setDisplaySelectorWindow(false);
                octDisplayPanel.removeMouseListener(this);
                octDisplayPanel.removeMouseMotionListener(this);
                OctPolyLine ilm = ILMsegmenter.segmentILM(firstPoint,
                        secondPoint == null ? lastWindowPoint : secondPoint);
                Collections.getInstance().getOctDrawnLineCollection().add(ilm);
                //use ILM segmented line to find local minima and place LRP
                Point maxYPoint = ilm.stream().max(Comparator.comparingInt(p -> p.y)).orElse(ilm.get(0));
                int fovealCenterX = (int) Math.round(ilm.stream().filter(p -> p.y == maxYPoint.y)
                        .mapToInt(p -> p.x).average().getAsDouble());

                Lrp newLrp;
                try {
                    newLrp = new Lrp("Fovea", fovealCenterX, Oct.getInstance().getImageHeight() / 2,
                            lrpSettings.getLrpWidth(), lrpSettings.getLrpHeight(), LrpType.FOVEAL);
                    lrpCollection.setLrps(Arrays.asList(newLrp));
                    octDisplayPanel.removeMouseListener(this);
                    if (buttonToEnable != null) {
                        buttonToEnable.setEnabled(true);
                    }
                } catch (LRPBoundaryViolationException e1) {
                    JOptionPane.showMessageDialog(null, e1.getMessage() + " Try again.", "LRP generation error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
            }

            @Override
            public void mouseDragged(MouseEvent e) {
                Point dragPoint;
                if ((dragPoint = octDisplayPanel.convertPanelPointToOctPoint(e.getPoint())) != null) {
                    lastWindowPoint = dragPoint;
                    int minX = Math.min(firstPoint.x, dragPoint.x);
                    int minY = Math.min(firstPoint.y, dragPoint.y);
                    int width = Math.max(firstPoint.x, dragPoint.x) - minX;
                    int height = Math.max(firstPoint.y, dragPoint.y) - minY;
                    octWindowSelector.setRect(minX, minY, width, height);
                    displaySettings.setDisplaySelectorWindow(false);
                    displaySettings.setDisplaySelectorWindow(true);
                }
            }
        };

        octDisplayPanel.addMouseListener(selectorMouseListener);
        octDisplayPanel.addMouseMotionListener(selectorMouseListener);
    } else {
        JOptionPane.showMessageDialog(null,
                "Click on the OCT where the anchor LRP should go.\n" + "Use the arrow keys to move the LRP.\n"
                        + "If any setting are adjusted while in this mode\n"
                        + "you'll have to click the mouse on the OCT to regain\n"
                        + "the ability to move the LRP with the arrow keys.",
                "Click anchor point", JOptionPane.INFORMATION_MESSAGE);
        //listen for the location on the screen where the user clicks, create LRP at location
        octDisplayPanel.addMouseListener(new MouseInputAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                Point clickPoint;
                if ((clickPoint = octDisplayPanel.convertPanelPointToOctPoint(e.getPoint())) != null) {
                    Lrp newLrp;
                    try {
                        newLrp = new Lrp("Fovea", clickPoint.x, clickPoint.y, lrpSettings.getLrpWidth(),
                                lrpSettings.getLrpHeight(), LrpType.FOVEAL);
                        lrpCollection.setLrps(Arrays.asList(newLrp));
                        octDisplayPanel.removeMouseListener(this);
                        if (buttonToEnable != null) {
                            buttonToEnable.setEnabled(true);
                        }
                    } catch (LRPBoundaryViolationException e1) {
                        JOptionPane.showMessageDialog(null, e1.getMessage() + " Try again.",
                                "LRP generation error", JOptionPane.ERROR_MESSAGE);
                        return;
                    }

                }
            }
        });

    }
}

From source file:net.sf.jabref.collab.ChangeScanner.java

public void displayResult(final DisplayResultCallback fup) {
    if (changes.getChildCount() > 0) {
        SwingUtilities.invokeLater(() -> {
            ChangeDisplayDialog dial = new ChangeDisplayDialog(frame, panel, inTemp, changes);
            dial.setLocationRelativeTo(frame);
            dial.setVisible(true);/*from  w w  w .j  a  va  2  s  . co  m*/
            fup.scanResultsResolved(dial.isOkPressed());
            if (dial.isOkPressed()) {
                // Overwrite the temp database:
                storeTempDatabase();
            }
        });

    } else {
        JOptionPane.showMessageDialog(frame, Localization.lang("No actual changes found."),
                Localization.lang("External changes"), JOptionPane.INFORMATION_MESSAGE);
        fup.scanResultsResolved(true);
    }
}

From source file:com.leclercb.taskunifier.gui.processes.license.ProcessGetTrial.java

private void showResult(final String code, final String message) throws Exception {
    ProcessUtils.executeOrInvokeAndWait(new Callable<Void>() {

        @Override/*from  w ww .j av a  2  s.  c  o  m*/
        public Void call() {
            if (EqualsUtils.equals(code, "0")) {
                JOptionPane.showMessageDialog(FrameUtils.getCurrentWindow(), message,
                        Translations.getString("general.information"), JOptionPane.INFORMATION_MESSAGE);
            } else {
                ErrorInfo info = new ErrorInfo(Translations.getString("general.error"), message, null, "GUI",
                        null, Level.INFO, null);

                JXErrorPane.showDialog(FrameUtils.getCurrentWindow(), info);
            }

            return null;
        }

    });
}

From source file:gov.nih.nci.nbia.StandaloneDMDispatcher.java

private void checkManifestVersion(String manifestVersion) {
    if ((manifestVersion != null) && (Double.valueOf(manifestVersion) > Double.valueOf(appVersion))) {
        Object[] options = { "OK" };
        int n = JOptionPane.showOptionDialog(null, manifestVersionNewMsg,
                "Incompatible Manifest File Version Notification", JOptionPane.OK_OPTION,
                JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
    }//from w ww  .j  a v  a2  s .co m

    if (((manifestVersion == null) && (supportedVersion != null))
            || ((manifestVersion != null) && (supportedVersion != null)
                    && (Double.valueOf(manifestVersion) < Double.valueOf(supportedVersion)))) {
        Object[] options = { "OK" };
        int n = JOptionPane.showOptionDialog(null, manifestVersionMsg + appVersion + ".",
                "Incompatible Manifest File Version Notification", JOptionPane.OK_OPTION,
                JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
        System.exit(n);
    }
}

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

/**
 * Do action.//  ww w. java 2s.com
 */
@Override
protected void doAction() {
    File csrFile = null;
    FileOutputStream fos = null;

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

        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());

        String keyPairAlg = privateKey.getAlgorithm();
        KeyPairType keyPairType = KeyPairUtil.getKeyPairType(privateKey);

        if (keyPairType == null) {
            throw new CryptoException(MessageFormat
                    .format(res.getString("GenerateCsrAction.NoCsrForKeyPairAlg.message"), keyPairAlg));
        }

        // determine dir of current keystore as proposal for CSR file location
        String path = CurrentDirectory.get().getAbsolutePath();
        File keyStoreFile = history.getFile();
        if (keyStoreFile != null) {
            path = keyStoreFile.getAbsoluteFile().getParent();
        }

        DGenerateCsr dGenerateCsr = new DGenerateCsr(frame, alias, privateKey, keyPairType, path, provider);
        dGenerateCsr.setLocationRelativeTo(frame);
        dGenerateCsr.setVisible(true);

        if (!dGenerateCsr.generateSelected()) {
            return;
        }

        CsrType format = dGenerateCsr.getFormat();
        SignatureType signatureType = dGenerateCsr.getSignatureType();
        String challenge = dGenerateCsr.getChallenge();
        String unstructuredName = dGenerateCsr.getUnstructuredName();
        boolean useCertificateExtensions = dGenerateCsr.isAddExtensionsWanted();
        csrFile = dGenerateCsr.getCsrFile();

        X509Certificate firstCertInChain = X509CertUtil
                .orderX509CertChain(X509CertUtil.convertCertificates(keyStore.getCertificateChain(alias)))[0];

        fos = new FileOutputStream(csrFile);

        if (format == CsrType.PKCS10) {
            String csr = Pkcs10Util.getCsrEncodedDerPem(Pkcs10Util.generateCsr(firstCertInChain, privateKey,
                    signatureType, challenge, unstructuredName, useCertificateExtensions, provider));

            fos.write(csr.getBytes());
        } else {
            SpkacSubject subject = new SpkacSubject(
                    X500NameUtils.x500PrincipalToX500Name(firstCertInChain.getSubjectX500Principal()));
            PublicKey publicKey = firstCertInChain.getPublicKey();

            // TODO handle other providers (PKCS11 etc)
            Spkac spkac = new Spkac(challenge, signatureType, subject, publicKey, privateKey);

            spkac.output(fos);
        }
    } catch (FileNotFoundException ex) {
        JOptionPane.showMessageDialog(frame,
                MessageFormat.format(res.getString("GenerateCsrAction.NoWriteFile.message"), csrFile),
                res.getString("GenerateCsrAction.GenerateCsr.Title"), JOptionPane.WARNING_MESSAGE);
        return;
    } catch (Exception ex) {
        DError.displayError(frame, ex);
        return;
    } finally {
        IOUtils.closeQuietly(fos);
    }

    JOptionPane.showMessageDialog(frame, res.getString("GenerateCsrAction.CsrGenerationSuccessful.message"),
            res.getString("GenerateCsrAction.GenerateCsr.Title"), JOptionPane.INFORMATION_MESSAGE);
}

From source file:mupomat.view.PodrskaLozinka.java

private void posaljiEmail() {

    final String username = "mupomat@gmail.com";
    final String password = "lesnibokysr187";

    Properties props = new Properties();
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.host", "smtp.gmail.com");
    props.put("mail.smtp.port", "587");

    Session session = Session.getInstance(props, new javax.mail.Authenticator() {
        @Override//from  w ww. j a  v  a  2 s.c om
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password);
        }
    });

    try {

        Message message = new MimeMessage(session);
        message.setFrom(new InternetAddress("mupomat@gmail.com"));
        message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(txtEmail.getText().trim()));
        message.setSubject("MUPomat podrka");

        message.setText("Nova lozinka: " + generiranaLozinka
                + "\nMolimo Vas da nakon prijave promjenite lozinku radi sigurnosti.\nHvala.");

        Transport.send(message);
        this.dispose();
        JOptionPane.showMessageDialog(rootPane, "Lozinka je uspjeno poslana na Vau e-mail adresu!",
                "MUPomat: Podrka", JOptionPane.INFORMATION_MESSAGE);

    } catch (MessagingException e) {
        throw new RuntimeException(e);
    }

}

From source file:com.sittinglittleduck.DirBuster.CheckForUpdates.java

private void showAlreadyLatestVersionMessage() {
    if (informUser) {
        JOptionPane.showMessageDialog(manager.gui, "You are running the latest version",
                "You are running the latest version", JOptionPane.INFORMATION_MESSAGE);
    }/*from  ww w  .  j  ava 2  s  .com*/
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.LoadGenericDRDataController.java

/**
 * Private methods//from  ww w. j  a v a2  s. c  o m
 */
//init view
private void initDataLoadingPanel() {
    dataLoadingPanel = new DRDataLoadingPanel();
    /**
     * Action Listeners.
     */
    //Popup file selector and import and parse the file
    dataLoadingPanel.getChooseFileButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // Open a JFile Chooser
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle(
                    "Choose a tabular file (XLS, XLSX, CSV, TSV) for the import of the experiment");
            // to select only appropriate files
            fileChooser.setFileFilter(new FileFilter() {
                @Override
                public boolean accept(File f) {
                    if (f.isDirectory()) {
                        return true;
                    }
                    int index = f.getName().lastIndexOf(".");
                    String extension = f.getName().substring(index + 1);
                    return extension.equals("xls") || extension.equals("xlsx") || extension.equals("csv")
                            || extension.equals("tsv");
                }

                @Override
                public String getDescription() {
                    return (".xls, .xlsx, .csv and .tsv files");
                }
            });
            fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            fileChooser.setAcceptAllFileFilterUsed(false);
            // in response to the button click, show open dialog
            int returnVal = fileChooser.showOpenDialog(dataLoadingPanel);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File chosenFile = fileChooser.getSelectedFile();
                //                    // create and execute a new swing worker with the selected file for the import
                //                    ImportExperimentSwingWorker importExperimentSwingWorker = new ImportExperimentSwingWorker(chosenFile);
                //                    importExperimentSwingWorker.execute();
                parseDRFile(chosenFile);
                if (doseResponseController.getImportedDRDataHolder().getDoseResponseData() != null) {
                    dataLoadingPanel.getFileLabel().setText(chosenFile.getAbsolutePath());
                    doseResponseController.getGenericDRParentPanel().getNextButton().setEnabled(true);
                }
            } else {
                JOptionPane.showMessageDialog(dataLoadingPanel, "Command cancelled by user", "",
                        JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });

    dataLoadingPanel.getLogTransformCheckBox().addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                doseResponseController.setLogTransform(true);
            } else {
                doseResponseController.setLogTransform(false);
            }
        }
    });
}