Advertisement
jdalbey

JOptionPane dialog homework skeleton

Jan 9th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. /**
  3.  * Skeleton code for homework problem.
  4.  */
  5. public final class EnhancedDialog
  6. {
  7.     /**
  8.      *  Entry point for the application.
  9.      *  @param args not used
  10.      */
  11.     public static void main(String[] args)
  12.     {
  13.         int choice = JOptionPane.showConfirmDialog(null,
  14.              "Would you like an A in CPE 305?", "choose one", JOptionPane.YES_NO_OPTION);
  15.         // Interpret user's choice    
  16.         if (choice == JOptionPane.NO_OPTION)
  17.         {
  18.             System.out.println("A not desired.");
  19.         }
  20.         else
  21.         {
  22.             System.out.println("Desires an A.");
  23.         }        
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement