// DialogInputDemo.java

import javax.swing.JOptionPane;

class DialogInputDemo
{
   public static void main(String[] args)
   {
      Object[] possibleValues = { "First", "Second", "Third" };
      Object selectedValue = JOptionPane.showInputDialog(null,
                                "Message: Choose one:",
                                "Title",
                                JOptionPane.QUESTION_MESSAGE,
                                null,
                                possibleValues,
                                possibleValues[0]);
      System.out.println("You selected: " + (String) selectedValue);

      int choice = JOptionPane.showConfirmDialog(null,
                               "Message: Choose one:",
                               "Title",
                                JOptionPane.YES_NO_OPTION);

      System.out.println("You selected: " + choice);
      System.exit(0);
   }  // method main
}  // class DialogInputDemo