Example usage for javax.swing JOptionPane showMessageDialog

List of usage examples for javax.swing JOptionPane showMessageDialog

Introduction

In this page you can find the example usage for javax.swing JOptionPane showMessageDialog.

Prototype

public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType,
        Icon icon) throws HeadlessException 

Source Link

Document

Brings up a dialog displaying a message, specifying all parameters.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    final ImageIcon icon = new ImageIcon("C:/folder/location.png");
    JOptionPane.showMessageDialog(null, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, icon);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    final ImageIcon icon = new ImageIcon(new URL("http://www.java2s.com/style/download.png"));
    JOptionPane.showMessageDialog(null, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, icon);
}

From source file:core.Utility.java

public static void ShowError(String title, String message) {
    JOptionPane.showMessageDialog(null, message, title, JOptionPane.ERROR_MESSAGE, null);
}

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 {//w  w w .  j  av a2 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: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);
            }/*from  w w w  .  j a v a  2s . co m*/
        } else {
            JOptionPane.showMessageDialog(parent, labels.getString("xsltNotSaved") + ".",
                    labels.getString("fileNotSaved"), JOptionPane.ERROR_MESSAGE, Utilities.icon);
        }
    }
}

From source file:de.atomfrede.tools.evalutation.util.DialogUtil.java

public int showErrorDialog(String title, String errorMessage) {
    JOptionPane.showMessageDialog(frame, errorMessage, title, JOptionPane.ERROR_MESSAGE,
            Icons.IC_DIALOG_ERROR_LARGE);
    return 0;/*from   w w w.j  a v a 2  s  .c o m*/
}