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:JOptionDemo.java

JOptionDemo(String s) {
    super(s);//from   w w w .  ja  v  a2s. c o  m

    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());

    JButton b = new JButton("Give me a message");
    b.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(JOptionDemo.this, "This is your message: etaoin shrdlu",
                    "Coded Message", JOptionPane.INFORMATION_MESSAGE);
        }
    });
    cp.add(b);

    b = new JButton("Goodbye!");
    b.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    cp.add(b);

    // size the main window
    pack();
}

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

void checkCompatibility() {
    if (!serverUrl.endsWith("Servlet")) {
        Object[] options = { "OK" };

        int n = JOptionPane.showOptionDialog(frame, serverVersionMsg, "Incompatible Server Notification",
                JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
        System.exit(n);/*  w  w  w.  j  ava 2 s.c o  m*/
    }
}

From source file:eu.apenet.dpt.standalone.gui.validation.DownloadReportActionListener.java

public void actionPerformed(ActionEvent e) {
    String defaultSaveLocation = dataPreparationToolGUI.getDefaultSaveLocation();
    File file = new File(defaultSaveLocation + "report.txt");
    try {/*from   w ww  .j av  a  2  s.  co  m*/
        FileInstance fileInstance = dataPreparationToolGUI.getFileInstances()
                .get(((File) dataPreparationToolGUI.getXmlEadList().getSelectedValue()).getName());
        FileUtils.writeStringToFile(file, getStringFromMap(fileInstance.getXmlQualityErrors()));
        JOptionPane.showMessageDialog(dataPreparationToolGUI.getContentPane(),
                MessageFormat.format(dataPreparationToolGUI.getLabels().getString("dataquality.reportSaved"),
                        defaultSaveLocation),
                dataPreparationToolGUI.getLabels().getString("fileSaved"), JOptionPane.INFORMATION_MESSAGE,
                Utilities.icon);
    } catch (IOException e1) {
        LOG.error("Could not save the report.txt file", e1);
        JOptionPane.showMessageDialog(dataPreparationToolGUI.getContentPane(),
                dataPreparationToolGUI.getLabels().getString("dataquality.reportSavedError"),
                dataPreparationToolGUI.getLabels().getString("fileSaved"), JOptionPane.ERROR_MESSAGE,
                Utilities.icon);
    }
}

From source file:net.sf.firemox.ui.MdbListener.java

/**
 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 *///w w w  .j  ava  2  s  .  c  o m
public void actionPerformed(ActionEvent e) {
    if ("menu_options_tbs_more".equals(e.getActionCommand())) {
        // goto "more TBS" page
        try {
            WebBrowser.launchBrowser("http://sourceforge.net/project/showfiles.php?group_id="
                    + IdConst.PROJECT_ID + "&package_id=107882");
        } catch (Exception e1) {
            JOptionPane.showOptionDialog(MagicUIComponents.magicForm,
                    LanguageManager.getString("error") + " : " + e1.getMessage(),
                    LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE,
                    UIHelper.getIcon("wiz_update_error.gif"), null, null);
        }
        return;
    }
    if ("menu_options_tbs_update".equals(e.getActionCommand())) {
        // update the current TBS
        XmlConfiguration.main(new String[] { "-g", MToolKit.tbsName });
        return;
    }
    if ("menu_options_tbs_rebuild".equals(e.getActionCommand())) {
        /*
         * rebuild completely the current TBS
         */
        XmlConfiguration.main(new String[] { "-f", "-g", MToolKit.tbsName });
        return;
    }

    // We change the TBS

    // Wait for confirmation
    if (JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(MagicUIComponents.magicForm,
            LanguageManager.getString("warn-disconnect"), LanguageManager.getString("disconnect"),
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, UIHelper.getIcon("wiz_update.gif"), null,
            null)) {

        // Save the current settings before changing TBS
        Magic.saveSettings();

        // Copy this settings file to the profile directory of this TBS
        final File propertyFile = MToolKit.getFile(IdConst.FILE_SETTINGS);
        try {
            FileUtils.copyFile(propertyFile, MToolKit.getTbsFile(IdConst.FILE_SETTINGS_SAVED, false));

            // Delete the current settings file of old TBS
            propertyFile.delete();

            // Load the one of the new TBS
            abstractMainForm.setMdb(e.getActionCommand());
            Configuration.loadTemplateFile(
                    MToolKit.getTbsFile(IdConst.FILE_SETTINGS_SAVED, false).getAbsolutePath());

            // Copy the saved configuration of new TBS
            FileUtils.copyFile(MToolKit.getTbsFile(IdConst.FILE_SETTINGS_SAVED, false), propertyFile);
            Log.info("Successful TBS swith to " + MToolKit.tbsName);

            // Restart the game
            System.exit(IdConst.EXIT_CODE_RESTART);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}

From source file:eu.apenet.dpt.standalone.gui.XsltAdderActionListener.java

public void actionPerformed(ActionEvent e) {
    JFileChooser xsltChooser = new JFileChooser();
    xsltChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    if (xsltChooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
        File file = xsltChooser.getSelectedFile();
        if (isXSLT(file)) {
            if (saveXslt(file)) {
                JRadioButton newButton = new JRadioButton(file.getName());
                newButton.addActionListener(new XsltSelectorListener(dataPreparationToolGUI));
                dataPreparationToolGUI.getGroupXslt().add(newButton);
                dataPreparationToolGUI.getAPEPanel().getApeTabbedPane().addToXsltPanel(newButton);
                dataPreparationToolGUI.getAPEPanel().getApeTabbedPane()
                        .addToXsltPanel(Box.createRigidArea(new Dimension(0, 10)));
                JOptionPane.showMessageDialog(parent, labels.getString("xsltSaved") + ".",
                        labels.getString("fileSaved"), JOptionPane.INFORMATION_MESSAGE, Utilities.icon);
            } else {
                JOptionPane.showMessageDialog(parent, labels.getString("xsltNotSaved") + ".",
                        labels.getString("fileNotSaved"), JOptionPane.ERROR_MESSAGE, Utilities.icon);
            }/* ww w.jav  a2 s  . c  o m*/
        } else {
            JOptionPane.showMessageDialog(parent, labels.getString("xsltNotSaved") + ".",
                    labels.getString("fileNotSaved"), JOptionPane.ERROR_MESSAGE, Utilities.icon);
        }
    }
}

From source file:net.rptools.maptool.client.AppSetup.java

public static void installLibrary(final String libraryName, final File root) throws IOException {
    // Add as a resource root
    AppPreferences.addAssetRoot(root);/*from   ww  w .  j  a  v a 2  s  . c  o  m*/
    if (MapTool.getFrame() != null) {
        MapTool.getFrame().addAssetRoot(root);

        // License
        File licenseFile = new File(root, "License.txt");
        if (!licenseFile.exists()) {
            licenseFile = new File(root, "license.txt");
        }
        if (licenseFile.exists()) {
            final File licenseFileFinal = licenseFile;
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        JTextPane pane = new JTextPane();
                        pane.setPage(licenseFileFinal.toURI().toURL());
                        JOptionPane.showMessageDialog(MapTool.getFrame(), pane, "License for " + libraryName,
                                JOptionPane.INFORMATION_MESSAGE);
                    } catch (MalformedURLException e) {
                        log.error("Could not load license file: " + licenseFileFinal, e);
                    } catch (IOException e) {
                        log.error("Could not load license file: " + licenseFileFinal, e);
                    }
                }
            });
        }
    }
    new SwingWorker<Object, Object>() {
        @Override
        protected Object doInBackground() throws Exception {
            AssetManager.searchForImageReferences(root, AppConstants.IMAGE_FILE_FILTER);
            return null;
        }
    }.execute();
}

From source file:EnrollFingerprint.Enroll.java

/**
 * Creates new form Enroll/*from www  .j a va 2s  .  c  om*/
 */
public Enroll() {
    initComponents();
    updateStatus();

    // Event listener actived when fingerprint template is ready
    this.addPropertyChangeListener(TEMPLATE_PROPERTY, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            btnSave.setEnabled(template != null);
            if (evt.getNewValue() == evt.getOldValue()) {
                return;
            }
            if (template != null) {
                JOptionPane.showMessageDialog(Enroll.this, "La huella capturada esta lista para ser guardada.",
                        "Captura y Registro de huellas", JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });
}

From source file:edu.harvard.i2b2.query.ui.QueryRequestClient.java

public static String sendQueryRequestREST(String XMLstr) {
    try {//from w w  w. j a  v  a2s  .com
        MessageUtil.getInstance()
                .setRequest("URL: " + getCRCNavigatorQueryProcessorServiceName() + "\n" + XMLstr);

        OMElement payload = getQueryPayLoad(XMLstr);
        Options options = new Options();
        targetEPR = new EndpointReference(getCRCNavigatorQueryProcessorServiceName());
        options.setTo(targetEPR);
        options.setTo(targetEPR);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
        options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(200000));
        options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(200000));

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

        OMElement result = sender.sendReceive(payload);
        // System.out.println(result.toString());
        MessageUtil.getInstance()
                .setResponse("URL: " + getCRCNavigatorQueryProcessorServiceName() + "\n" + result.toString());
        return result.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 (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:de.dakror.villagedefense.util.SaveHandler.java

public static void saveGame() {
    try {/*  www  .  ja v a 2 s . co m*/
        File save = new File(CFG.DIR, "saves/"
                + new SimpleDateFormat("'Spielstand' dd.MM.yyyy HH-mm-ss").format(new Date()) + ".save");
        save.createNewFile();

        JSONObject o = new JSONObject();

        o.put("version", CFG.VERSION);
        o.put("created", Game.currentGame.worldCreated);
        o.put("width", Game.world.width);
        o.put("height", Game.world.height);
        o.put("tile", new BASE64Encoder().encode(Compressor.compressRow(Game.world.getData())));
        o.put("resources", Game.currentGame.resources.getData());
        o.put("researches", Game.currentGame.researches);
        o.put("wave", WaveManager.wave);
        o.put("time", WaveManager.nextWave);

        JSONArray entities = new JSONArray();
        for (Entity e : Game.world.entities) {
            if ((e instanceof Forester) || (e instanceof Woodsman))
                continue; // don't save them, because they get spawned by the house upgrades

            entities.put(e.getData());
        }
        o.put("entities", entities);

        Compressor.compressFile(save, o.toString());
        //         Helper.setFileContent(new File(save.getPath() + ".debug"), o.toString());
        Game.currentGame.state = 3;
        JOptionPane.showMessageDialog(Game.w, "Spielstand erfolgreich gespeichert.", "Speichern erfolgreich",
                JOptionPane.INFORMATION_MESSAGE);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ScrollDemo2.java

public void init() {
    JRadioButton form[][] = new JRadioButton[12][5];
    String counts[] = { "", "0-1", "2-5", "6-10", "11-100", "101+" };
    String categories[] = { "Household", "Office", "Extended Family", "Company (US)", "Company (World)", "Team",
            "Will", "Birthday Card List", "High School", "Country", "Continent", "Planet" };
    JPanel p = new JPanel();
    p.setSize(600, 400);//www .j a  va 2  s. c  om
    p.setLayout(new GridLayout(13, 6, 10, 0));
    for (int row = 0; row < 13; row++) {
        ButtonGroup bg = new ButtonGroup();
        for (int col = 0; col < 6; col++) {
            if (row == 0) {
                p.add(new JLabel(counts[col]));
            } else {
                if (col == 0) {
                    p.add(new JLabel(categories[row - 1]));
                } else {
                    form[row - 1][col - 1] = new JRadioButton();
                    bg.add(form[row - 1][col - 1]);
                    p.add(form[row - 1][col - 1]);
                }
            }
        }
    }
    scrollpane = new JScrollPane(p);

    // Add in some JViewports for the column and row headers
    JViewport jv1 = new JViewport();
    jv1.setView(new JLabel(new ImageIcon("columnlabel.gif")));
    scrollpane.setColumnHeader(jv1);
    JViewport jv2 = new JViewport();
    jv2.setView(new JLabel(new ImageIcon("rowlabel.gif")));
    scrollpane.setRowHeader(jv2);

    // And throw in an information button
    JButton jb1 = new JButton(new ImageIcon("question.gif"));
    jb1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            JOptionPane.showMessageDialog(null, "This is an Active Corner!", "Information",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    });
    scrollpane.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, jb1);
    getContentPane().add(scrollpane, BorderLayout.CENTER);
}