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)
        throws HeadlessException 

Source Link

Document

Brings up a dialog that displays a message using a default icon determined by the messageType parameter.

Usage

From source file:ExecDemoNS.java

public void doWait() {
    if (pStack.size() == 0)
        return;//from w ww  .  j  a v  a2  s.com
    try {
        pStack.peek().waitFor();
        // wait for process to complete (does not work as expected for Windows programs)
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(this, "Error" + ex, "Error", JOptionPane.ERROR_MESSAGE);
    }
    pStack.pop();
}

From source file:edu.harvard.i2b2.timeline.lifelines.PDOQueryClient.java

public static String sendQueryRequestREST(String XMLstr) {
    try {//from   w ww  . j ava  2 s  .c  o  m
        MessageUtil.getInstance().setRequest("URL: " + getPDOServiceName() + "\n" + XMLstr);

        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);
        // System.out.println("Client Side response " +
        // responseElement.toString());
        MessageUtil.getInstance()
                .setResponse("URL: " + getPDOServiceName() + "\n" + 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 (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:de.dakror.virtualhub.client.dialog.ChooseCatalogDialog.java

public static void show(ClientFrame frame, final JSONArray data) {
    final JDialog dialog = new JDialog(frame, "Katalog whlen", true);
    dialog.setSize(400, 300);/*from  w  ww. j  ava 2s  .c  o  m*/
    dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Client.currentClient.disconnect();
            System.exit(0);
        }
    });

    JPanel contentPane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    dialog.setContentPane(contentPane);
    DefaultListModel dlm = new DefaultListModel();
    for (int i = 0; i < data.length(); i++) {
        try {
            dlm.addElement(data.getJSONObject(i).getString("name"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    final JList catalogs = new JList(dlm);
    catalogs.setDragEnabled(false);
    catalogs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JScrollPane jsp = new JScrollPane(catalogs, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jsp.setPreferredSize(new Dimension(396, 200));
    contentPane.add(jsp);

    JPanel mods = new JPanel(new GridLayout(1, 2));
    mods.setPreferredSize(new Dimension(50, 22));
    mods.add(new JButton(new AbstractAction("+") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            String name = JOptionPane.showInputDialog(dialog,
                    "Bitte geben Sie den Namen des neuen Katalogs ein.", "Katalog hinzufgen",
                    JOptionPane.PLAIN_MESSAGE);
            if (name != null && name.length() > 0) {
                DefaultListModel dlm = (DefaultListModel) catalogs.getModel();
                for (int i = 0; i < dlm.getSize(); i++) {
                    if (dlm.get(i).toString().equals(name)) {
                        JOptionPane.showMessageDialog(dialog,
                                "Es existert bereits ein Katalog mit diesem Namen!",
                                "Katalog bereits vorhanden!", JOptionPane.ERROR_MESSAGE);
                        actionPerformed(e);
                        return;
                    }
                }

                try {
                    dlm.addElement(name);
                    JSONObject o = new JSONObject();
                    o.put("name", name);
                    o.put("sources", new JSONArray());
                    o.put("tags", new JSONArray());
                    data.put(o);
                    Client.currentClient.sendPacket(new Packet0Catalogs(data));
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        }
    }));
    mods.add(new JButton(new AbstractAction("-") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            if (catalogs.getSelectedIndex() != -1) {
                if (JOptionPane.showConfirmDialog(dialog,
                        "Sind Sie sicher, dass Sie diesen\r\nKatalog unwiderruflich lschen wollen?",
                        "Katalog lschen", JOptionPane.YES_NO_CANCEL_OPTION,
                        JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
                    DefaultListModel dlm = (DefaultListModel) catalogs.getModel();
                    data.remove(catalogs.getSelectedIndex());
                    dlm.remove(catalogs.getSelectedIndex());
                    try {
                        Client.currentClient.sendPacket(new Packet0Catalogs(data));
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    }));

    contentPane.add(mods);

    JLabel l = new JLabel("");
    l.setPreferredSize(new Dimension(396, 14));
    contentPane.add(l);

    JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
    sep.setPreferredSize(new Dimension(396, 10));
    contentPane.add(sep);

    JPanel buttons = new JPanel(new GridLayout(1, 2));
    buttons.setPreferredSize(new Dimension(396, 22));
    buttons.add(new JButton(new AbstractAction("Abbrechen") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            Client.currentClient.disconnect();
            System.exit(0);
        }
    }));
    buttons.add(new JButton(new AbstractAction("Katalog whlen") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            if (catalogs.getSelectedIndex() != -1) {
                try {
                    Client.currentClient
                            .setCatalog(new Catalog(data.getJSONObject(catalogs.getSelectedIndex())));
                    Client.currentClient.frame.setTitle("- " + Client.currentClient.getCatalog().getName());
                    dialog.dispose();
                } catch (JSONException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }));

    dialog.add(buttons);

    dialog.setLocationRelativeTo(frame);
    dialog.setResizable(false);
    dialog.setVisible(true);
}

From source file:edu.smc.mediacommons.panels.SecurityPanel.java

public SecurityPanel() {
    setLayout(null);//  w  w w  .  ja va 2s . co m

    FILE_CHOOSER = new JFileChooser();

    JButton openFile = Utils.createButton("Open File", 10, 20, 100, 30, null);
    add(openFile);

    JButton saveFile = Utils.createButton("Save File", 110, 20, 100, 30, null);
    add(saveFile);

    JButton decrypt = Utils.createButton("Decrypt", 210, 20, 100, 30, null);
    add(decrypt);

    JButton encrypt = Utils.createButton("Encrypt", 310, 20, 100, 30, null);
    add(encrypt);

    JTextField path = Utils.createTextField(10, 30, 300, 20);
    path.setText("No file selected");

    final JTextArea viewer = new JTextArea();
    JScrollPane pastePane = new JScrollPane(viewer);
    pastePane.setBounds(15, 60, 400, 200);
    add(pastePane);

    openFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (FILE_CHOOSER.showOpenDialog(getParent()) == JFileChooser.APPROVE_OPTION) {
                File toRead = FILE_CHOOSER.getSelectedFile();

                if (toRead == null) {
                    JOptionPane.showMessageDialog(getParent(), "The input file does not exist!",
                            "Opening Failed...", JOptionPane.WARNING_MESSAGE);
                } else {
                    try {
                        List<String> lines = IOUtils.readLines(new FileInputStream(toRead), "UTF-8");

                        viewer.setText("");

                        for (String line : lines) {
                            viewer.append(line);
                        }
                    } catch (IOException ex) {

                    }
                }
            }
        }
    });

    saveFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (FILE_CHOOSER.showSaveDialog(getParent()) == JFileChooser.APPROVE_OPTION) {
                File toWrite = FILE_CHOOSER.getSelectedFile();

                Utils.writeToFile(viewer.getText(), toWrite);
                JOptionPane.showMessageDialog(getParent(),
                        "The file has now been saved to\n" + toWrite.getPath());
            }
        }
    });

    encrypt.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String password = Utils.getPasswordInput(getParent());

            if (password != null) {
                try {
                    BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();
                    basicTextEncryptor.setPassword(password);

                    String text = basicTextEncryptor.encrypt(viewer.getText());
                    viewer.setText(text);
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(getParent(),
                            "Could not encrypt the text, an unexpected error occurred.", "Encryption Failed...",
                            JOptionPane.WARNING_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(getParent(),
                        "Could not encrypt the text, as no\npassword has been specified.",
                        "Encryption Failed...", JOptionPane.WARNING_MESSAGE);
            }
        }
    });

    decrypt.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String password = Utils.getPasswordInput(getParent());

            if (password != null) {
                try {
                    BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();
                    basicTextEncryptor.setPassword(password);

                    String text = basicTextEncryptor.decrypt(viewer.getText());
                    viewer.setText(text);
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(getParent(),
                            "Could not decrypt the text, an unexpected error occurred.", "Decryption Failed...",
                            JOptionPane.WARNING_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(getParent(),
                        "Could not decrypt the text, as no\npassword has been specified.",
                        "Decryption Failed...", JOptionPane.WARNING_MESSAGE);
            }
        }
    });
}

From source file:FileTree2.java

public FileTree2() {
    super("Directories Tree [Popup Menus]");
    setSize(400, 300);/* w  w  w  .  j a  v a  2  s  . c o  m*/

    DefaultMutableTreeNode top = new DefaultMutableTreeNode(new IconData(ICON_COMPUTER, null, "Computer"));

    DefaultMutableTreeNode node;
    File[] roots = File.listRoots();
    for (int k = 0; k < roots.length; k++) {
        node = new DefaultMutableTreeNode(new IconData(ICON_DISK, null, new FileNode(roots[k])));
        top.add(node);
        node.add(new DefaultMutableTreeNode(new Boolean(true)));
    }

    m_model = new DefaultTreeModel(top);
    m_tree = new JTree(m_model);

    m_tree.putClientProperty("JTree.lineStyle", "Angled");

    TreeCellRenderer renderer = new IconCellRenderer();
    m_tree.setCellRenderer(renderer);

    m_tree.addTreeExpansionListener(new DirExpansionListener());

    m_tree.addTreeSelectionListener(new DirSelectionListener());

    m_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    m_tree.setShowsRootHandles(true);
    m_tree.setEditable(false);

    JScrollPane s = new JScrollPane();
    s.getViewport().add(m_tree);
    getContentPane().add(s, BorderLayout.CENTER);

    m_display = new JTextField();
    m_display.setEditable(false);
    getContentPane().add(m_display, BorderLayout.NORTH);

    // NEW
    m_popup = new JPopupMenu();
    m_action = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (m_clickedPath == null)
                return;
            if (m_tree.isExpanded(m_clickedPath))
                m_tree.collapsePath(m_clickedPath);
            else
                m_tree.expandPath(m_clickedPath);
        }
    };
    m_popup.add(m_action);
    m_popup.addSeparator();

    Action a1 = new AbstractAction("Delete") {
        public void actionPerformed(ActionEvent e) {
            m_tree.repaint();
            JOptionPane.showMessageDialog(FileTree2.this, "Delete option is not implemented", "Info",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    };
    m_popup.add(a1);

    Action a2 = new AbstractAction("Rename") {
        public void actionPerformed(ActionEvent e) {
            m_tree.repaint();
            JOptionPane.showMessageDialog(FileTree2.this, "Rename option is not implemented", "Info",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    };
    m_popup.add(a2);
    m_tree.add(m_popup);
    m_tree.addMouseListener(new PopupTrigger());

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    setVisible(true);
}

From source file:net.schweerelos.parrot.CombinedParrotApp.java

/**
 * @param args/*w w  w .j  a va2 s.  c om*/
 */
@SuppressWarnings("static-access")
public static void main(String[] args) {
    CommandLineParser parser = new PosixParser();
    // create the Options
    Options options = new Options();
    options.addOption(OptionBuilder.withLongOpt("help")
            .withDescription("Shows usage information and quits the program").create("h"));

    options.addOption(
            OptionBuilder.withLongOpt("datafile").withDescription("The file with instances to use (required)")
                    .hasArg().withArgName("file").isRequired().create("f"));

    options.addOption(OptionBuilder.withLongOpt("properties")
            .withDescription("Properties file to use. Default: " + System.getProperty("user.home")
                    + File.separator + ".digital-parrot" + File.separator + "parrot.properties")
            .hasArg().withArgName("prop").create("p"));
    try {
        // parse the command line arguments
        CommandLine line = parser.parse(options, args);

        if (line.hasOption("h")) {
            // this is only executed when all required options are present _and_ the help option is specified!
            printHelp(options);
            return;
        }

        String datafile = line.getOptionValue("f");
        if (!datafile.startsWith("file:") || !datafile.startsWith("http:")) {
            datafile = "file:" + datafile;
        }

        String propertiesPath = System.getProperty("user.home") + File.separator + ".digital-parrot"
                + File.separator + "parrot.properties";
        if (line.hasOption("p")) {
            propertiesPath = line.getOptionValue("p");
        }
        final Properties properties = new Properties();
        File propertiesFile = new File(propertiesPath);
        if (propertiesFile.exists() && propertiesFile.canRead()) {
            try {
                properties.load(new FileReader(propertiesFile));
            } catch (FileNotFoundException e) {
                e.printStackTrace(System.err);
                System.exit(1);
            } catch (IOException e) {
                e.printStackTrace(System.err);
                System.exit(1);
            }
        }

        final String url = datafile; // we need a "final" var for the anonymous class
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                CombinedParrotApp inst = null;
                try {
                    inst = new CombinedParrotApp(properties);
                    inst.loadModel(url);
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null,
                            "There has been an error while starting the program.\nThe program will exit now.",
                            APP_TITLE + "  Error", JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace(System.err);
                    System.exit(1);
                }
                if (inst != null) {
                    inst.setLocationRelativeTo(null);
                    inst.setVisible(true);
                }
            }
        });
    } catch (ParseException exp) {
        printHelp(options);
    }
}

From source file:com.emental.mindraider.ui.panels.ConceptAttachmentsJPanel.java

public void init() {
    JPanel pp;/*w  w w .  ja  va 2s. c om*/
    setBorder(new TitledBorder(Messages.getString("ConceptJPanel.attachments")));
    setLayout(new BorderLayout());

    // button
    pp = new JPanel();
    pp.setLayout(new GridLayout(3, 1));
    JButton jbutton = new JButton("", IconsRegistry.getImageIcon("attach.png"));
    jbutton.setToolTipText(Messages.getString("ConceptJPanel.attachLocalResourceToConcept"));
    jbutton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // some concept must be selected - select graph node according
            // to the selected concept =-> touchgraph
            // method needed
            if (conceptJPanel.getConceptResource() == null) {
                JOptionPane.showMessageDialog(MindRaider.mainJFrame,
                        Messages.getString("ConceptJPanel.attachResourceWarning"),
                        Messages.getString("ConceptJPanel.attachmentError"), JOptionPane.ERROR_MESSAGE);
                return;
            }
            new AttachmentJDialog(conceptJPanel.getConceptResource());
        }
    });
    pp.add(jbutton);
    // @todo edit resource description
    // jbutton=new JButton("",IconsRegistry.getImageIcon("attachLink.png"));
    // jbutton.setToolTipText("Attach web resource to concept");
    // jbutton.addActionListener(new ActionListener() {
    // public void actionPerformed(ActionEvent e) {
    // }
    // });
    // pp.add(jbutton);
    // attach another concept/folder/resource... - perhaps extra frame with
    // radio
    jbutton = new JButton("", IconsRegistry.getImageIcon("launch.png"));
    jbutton.setToolTipText(Messages.getString("ConceptJPanel.showAttachment"));
    jbutton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (attachmentsTableModel.attachments != null) {
                if (attachments.getSelectedRow() == -1) {
                    JOptionPane.showMessageDialog(MindRaider.mainJFrame,
                            Messages.getString("ConceptJPanel.selectAttachmentToLaunch"),
                            Messages.getString("ConceptJPanel.attachmentError"), JOptionPane.ERROR_MESSAGE);
                    return;
                }
                String uri = attachmentsTableModel.attachments[attachments.getSelectedRow()].getUrl();
                if (uri != null) {
                    Node node = new Node();
                    node.setLabel(uri);
                    node.setURL(uri);
                    node.setType(
                            MindRaider.spidersColorProfileRegistry.getCurrentProfile().getLiteralNodeType());
                    MindRaider.spidersGraph.handleDoubleSelect(node);
                }
            }
        }
    });
    pp.add(jbutton);
    jbutton = new JButton("", IconsRegistry.getImageIcon("explorerDiscardSmall.png"));
    jbutton.setToolTipText(Messages.getString("ConceptJPanel.removeAttachment"));
    pp.add(jbutton);
    jbutton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (attachmentsTableModel.attachments != null) {
                if (getAttachments().getSelectedRow() != -1) {
                    logger.debug(Messages.getString("ConceptJPanel.removingAttachment",
                            getAttachments().getSelectedRow()));
                    String attachUrl = getAttachmentsTableModel().attachments[getAttachments().getSelectedRow()]
                            .getUrl();
                    logger.debug(Messages.getString("ConceptJPanel.removingAttachmentUrl", attachUrl));
                    if (conceptJPanel.getConceptResource() != null) {
                        // check, that selected node is type of literal
                        // (helper on spiders graph)
                        MindRaider.noteCustodian.removeAttachment(
                                MindRaider.profile.getActiveOutlineUri().toString(),
                                conceptJPanel.getConceptResource(), attachUrl);
                        conceptJPanel.refresh();
                        MindRaider.spidersGraph.renderModel();
                        return;
                    }
                }
                JOptionPane.showMessageDialog(MindRaider.mainJFrame,
                        Messages.getString("ConceptJPanel.selectAttachmentToRemove"),
                        Messages.getString("ConceptJPanel.attachmentError"), JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    add(pp, BorderLayout.EAST);

    // table
    attachmentsTableModel = new AttachmentsTableModel();
    attachments = new JTable(attachmentsTableModel) {

        private static final long serialVersionUID = 1L;

        public String getToolTipText(MouseEvent e) {
            String tip = null;
            java.awt.Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);

            AttachmentsTableModel model = (AttachmentsTableModel) getModel();
            tip = Messages.getString("ConceptJPanel.attachmentUrl") + model.attachments[rowIndex].getUrl();
            // You can omit this part if you know you don't
            // have any renderers that supply their own tool
            // tips.
            // tip = super.getToolTipText(e);
            return tip;
        }
    };
    TableColumn column = attachments.getColumnModel().getColumn(0);
    column.setMaxWidth(50);
    attachments.setRowHeight(20);
    attachments.setAutoscrolls(true);
    attachments.setPreferredScrollableViewportSize(new Dimension(500, 70));
    JScrollPane scrollPane = new JScrollPane(attachments);
    add(scrollPane, BorderLayout.CENTER);
}

From source file:com.googlecode.logVisualizer.chart.SkillCastOnTurnsChartMouseEventListener.java

public void chartMouseClicked(final ChartMouseEvent e) {
    if (e.getEntity() instanceof CategoryItemEntity) {
        final CategoryItemEntity entity = (CategoryItemEntity) e.getEntity();
        final String skillName = (String) entity.getColumnKey();

        final StringBuilder str = new StringBuilder(250);
        if (logData.isDetailedLog())
            for (final SingleTurn st : logData.getTurnsSpent()) {
                if (st.isSkillCast(skillName))
                    str.append(st.getTurnNumber() + ": " + getCastedSkill(st, skillName).getAmount() + "\n");
            }/*from w  ww .jav  a  2  s.c  om*/
        else
            for (final TurnInterval ti : logData.getTurnIntervalsSpent())
                if (ti.isSkillCast(skillName))
                    str.append(ti.getStartTurn() + "-" + ti.getEndTurn() + ": "
                            + getCastedSkill(ti, skillName).getAmount() + "\n");

        final JScrollPane text = new JScrollPane(new JTextArea(str.toString()));
        text.setPreferredSize(new Dimension(500, 450));
        JOptionPane.showMessageDialog(null, text, "Turn numbers and amount of casts of " + skillName,
                JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:com.googlecode.logVisualizer.chart.TurnsSpentInLevelChartMouseEventListener.java

public void chartMouseClicked(final ChartMouseEvent e) {
    if (e.getEntity() instanceof CategoryItemEntity) {
        final CategoryItemEntity entity = (CategoryItemEntity) e.getEntity();
        final Matcher m = levelNumberExtractor.matcher((String) entity.getColumnKey());
        m.find();//from  w  ww  .  j  av a 2  s.c om
        final int level = Integer.parseInt(m.group(1));

        final StringBuilder str = new StringBuilder(100);
        for (final TurnInterval ti : logData.getTurnIntervalsSpent()) {
            final int levelOnStart = logData.getCurrentLevel(ti.getStartTurn()).getLevelNumber();
            final int levelOnEnd = logData.getCurrentLevel(ti.getEndTurn()).getLevelNumber();

            if (levelOnStart > level)
                break;

            if (levelOnStart == level || levelOnEnd == level)
                str.append(ti + "\n");
        }

        final JScrollPane text = new JScrollPane(new JTextArea(str.toString()));
        text.setPreferredSize(new Dimension(500, 450));
        JOptionPane.showMessageDialog(null, text, "Areas visited during level " + level,
                JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:com.aw.swing.mvp.ui.msg.MessageDisplayerImpl.java

/**
 * Show a message used to inform to the user of something that happened
 *
 * @param message//from  ww  w.  ja va  2s.  c o m
 */
public static void showErrorMessage(Component parentContainer, String message) {
    ProcessMsgBlocker.instance().removeMessage();
    JOptionPane.showMessageDialog(parentContainer, message, GENERIC_MESSAGE_TITLE, JOptionPane.ERROR_MESSAGE);
}