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

public static void main(String[] argv) {
    JOptionPane.showMessageDialog(null, "The message", "The Title", JOptionPane.INFORMATION_MESSAGE);

}

From source file:JOptionPaneINFORMATION_MESSAGE.java

public static void main(String[] args) {
    final JPanel panel = new JPanel();

    JOptionPane.showMessageDialog(panel, "Download completed", "Question", JOptionPane.INFORMATION_MESSAGE);
}

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

public static void main(String[] a) {
    JOptionPane optionPane = new JOptionPane();
    optionPane.setMessage("Set Message");
    optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
    optionPane.setOptions(new Object[] { new JButton("Button") });
    JDialog dialog = optionPane.createDialog(null, "Icon/Text Button");
    dialog.setVisible(true);/*w w  w  .  j  a va2 s .  c o  m*/
}

From source file:InputDialog.java

public static void main(String argv[]) {
    String input = (String) JOptionPane.showInputDialog(new JFrame(),
            "Please enter your favorite Shakespeare play", "Title", JOptionPane.INFORMATION_MESSAGE,
            new ImageIcon("java2sLogo.GIF"), null, "Romeo and Juliet");
    System.out.println("User's input: " + input);
}

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

public static void main(String[] args) {

    JFrame frame = new JFrame();

    frame.setVisible(true);/* www  .  j  a v  a 2  s .  com*/

    String message = JOptionPane.showInputDialog(frame, "Would this be enough?.", "My dialog asks....",
            JOptionPane.INFORMATION_MESSAGE);

    System.out.println("Got " + message);

    frame.dispose();
}

From source file:Main.java

public static void main(String[] args) {
    JComponent parentComponent = null;
    Object message = "Please select";
    String title = "JOptionPane Input Dialog";
    int messageType = JOptionPane.INFORMATION_MESSAGE;
    Icon icon = null;//from w w  w. j a  v  a  2  s  .  c  o  m
    Object[] selectionValues = new String[] { "A", "B", "C" };
    Object initialSelectionValue = selectionValues[2];
    Object response = JOptionPane.showInputDialog(parentComponent, message, title, messageType, icon,
            selectionValues, initialSelectionValue);

    if (response == null) {
        System.out.println("we have  cancelled the   input dialog.");
    } else {
        System.out.println("we entered:  " + response);
    }
}

From source file:Main.java

public static void main(String[] args) {
    JComponent parentComponent = null;
    Object message = "How  is JOptionPane?";
    String title = "JOptionPane Option  Dialog";
    int messageType = JOptionPane.INFORMATION_MESSAGE;
    Icon icon = null;// w  w w . j  a va2 s  . co  m
    Object[] options = new String[] { "A", "B", "C" };
    Object initialOption = options[2];
    int response = JOptionPane.showOptionDialog(null, message, title, JOptionPane.DEFAULT_OPTION,
            JOptionPane.QUESTION_MESSAGE, icon, options, initialOption);
    switch (response) {
    case 0:
    case 1:
    case 2:
        System.out.println("we selected:" + options[response]);
        break;
    case JOptionPane.CLOSED_OPTION:
        System.out.println("we closed the   dialog box.");
        break;
    default:
        System.out.println("I don't know what  we  did.");
    }

}

From source file:ComboBoxDialog.java

public static void main(String argv[]) {
    String[] plays = new String[] { "Hamlet", "King Lear", "Otello", "Romeo and Juliet" };
    String input = (String) JOptionPane.showInputDialog(new JFrame(),
            "Please select your favorite Shakespeare play", "Title", JOptionPane.INFORMATION_MESSAGE,
            new ImageIcon("java2sLogo.GIF"), plays, "Romeo and Juliet");
    System.out.println("User's input: " + input);
}