Creating Pop Up Messages For Games

Hey, Ive not been programming long but Ive been given the task of creating a game, which I have done, but now I want to extend it further.

I have situations in the game where you can win and lose, and currently ive just got the game resetting itself when it happens (ie, if you lose the game, the game resets as if you were just starting to play the game). What I would like to do is implement a pop up message that says something like "You lose, play again?" and then hav selection buttons to restart the game or exit it, same for when you win.

I just really have no idea how to implement that as its not a case of System.out.println......

Ive overcome the other major problems in the game- its just this thats bugging me now, could anybody provide me any help or hints please? It would be much appreciated!

[835 byte] By [AzWa] at [2007-11-26 13:19:31]
# 1
Take a look at: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.htmlespecially the showOptionDialog part
Nethera at 2007-7-7 17:46:22 > top of Java-index,Other Topics,Java Game Development...
# 2

use JOptionPane.showConfirmDialog(...);

it pops a dialog containing 'yes' and 'no' buttons along with your message.

the dialog returns an integer value 1 or 0 coressponding to 'yes' or 'no'. u can determine which button was pressed and do appropriate action by checking the return value...

hopes this will help you....

faheda at 2007-7-7 17:46:22 > top of Java-index,Other Topics,Java Game Development...