Results 1 to 2 of 2

Thread: JOptionPane

  1. #1
    izzy is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default JOptionPane

    I have a JOption Pane with customised options, I was just wondering if there's a way to make the options do something else other than just close the window when it pops up?
    This is what i have so far:

    Java Code:
    Object[] options = {"Play Again", "Exit"};
    
    JOptionPane.showOptionDialog (frame, "Player X wins", "Congratulations", 
    JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options,
     options[0]);
    I already have defined methods in this class to play again and exit, and i want them to be called when the user selects one of these options on this JOptionPane. But at the moment, whatever button you click, it just closes the window.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Help with JOptionPane
    By sanctishit in forum New To Java
    Replies: 1
    Last Post: 03-10-2010, 10:20 AM
  2. need help for JOptionPane....
    By keycoffee in forum New To Java
    Replies: 1
    Last Post: 02-09-2010, 08:59 AM
  3. Help with JOptionPane
    By SwEeTAcTioN in forum New To Java
    Replies: 12
    Last Post: 11-03-2009, 04:12 AM
  4. JOptionpane
    By tommyyyy in forum New To Java
    Replies: 2
    Last Post: 03-20-2009, 08:33 AM
  5. JOptionPane
    By whosadork in forum New To Java
    Replies: 2
    Last Post: 10-23-2008, 02:17 AM

Posting Permissions

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