Results 1 to 2 of 2

Thread: dialog boxes

  1. #1
    gedas is offline Member
    Join Date
    Feb 2010
    Posts
    51
    Rep Power
    0

    Default dialog boxes

    hey guys,
    in got a simple option dialog box with two options how can i make it call a method once i press for example on a yes button.
    here is a code for the dialog box that i have so far:
    Java Code:
       JFrame container =new JFrame();
          
           Object[] options = {"Yes, please",
                        "No,thanks!"};
         int n = JOptionPane.showOptionDialog(container,
        "Would you like to play again?","Congratolations",
         JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE,null,options, options[0]);
    thanks

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Read the API specs for the JOptionPane.showOptionDialog method. In particular, pay attention to the returned value that you are assigning to n.

Similar Threads

  1. average using dialog boxes.
    By sarahhh in forum New To Java
    Replies: 1
    Last Post: 01-22-2010, 10:10 PM
  2. List Boxes
    By zzpprk in forum AWT / Swing
    Replies: 2
    Last Post: 12-15-2009, 09:43 PM
  3. Dragging Boxes
    By anilanar in forum New To Java
    Replies: 8
    Last Post: 09-05-2009, 09:23 PM
  4. Replies: 2
    Last Post: 11-22-2008, 05:30 AM
  5. Help! Need to randomly assign boxes
    By newb101 in forum New To Java
    Replies: 1
    Last Post: 09-16-2008, 10:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •