Option game over
This commit is contained in:
parent
a6aebf2432
commit
c0102b7116
|
|
@ -51,10 +51,18 @@ public class MyInterface extends JFrame {
|
|||
private JLabel whiteTimerLabel;
|
||||
private JLabel blackTimerLabel;
|
||||
public TimerManager timerManager;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public MyInterface() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(10, 10, 800, 800);
|
||||
contentPane = new JPanel();
|
||||
|
|
@ -295,11 +303,25 @@ public class MyInterface extends JFrame {
|
|||
}
|
||||
|
||||
public void showGameOverMessage(String message) {
|
||||
JOptionPane.showMessageDialog(this, message, "Game Over", JOptionPane.INFORMATION_MESSAGE);
|
||||
game.toggleAI(false);
|
||||
game.toggleAI(false);
|
||||
game.toggleAI(true);
|
||||
chckbxWhiteAI.setSelected(false);
|
||||
chckbxBlackAI.setSelected(false);
|
||||
Object[] options = {"YES", "NO"};
|
||||
int choice = JOptionPane.showOptionDialog(this, "GAME OVER \nDo you want to exit? ",
|
||||
"Game Over",
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[1] // default: Medium
|
||||
);
|
||||
switch (choice) {
|
||||
case 0: System.exit(0);; // Easy
|
||||
case 1: ; // Medium
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private int askDifficulty() {
|
||||
|
|
@ -326,8 +348,8 @@ public class MyInterface extends JFrame {
|
|||
Object[] options = {"1 min", "2 Min", "5 Min", "10 Min"};
|
||||
int choice = JOptionPane.showOptionDialog(
|
||||
this,
|
||||
"Select Difficulty Level:",
|
||||
"Difficulty",
|
||||
"Select the duration of the game:",
|
||||
"Duration",
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE,
|
||||
null,
|
||||
|
|
|
|||
Loading…
Reference in New Issue