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 whiteTimerLabel;
|
||||||
private JLabel blackTimerLabel;
|
private JLabel blackTimerLabel;
|
||||||
public TimerManager timerManager;
|
public TimerManager timerManager;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the frame.
|
* Create the frame.
|
||||||
*/
|
*/
|
||||||
public MyInterface() {
|
public MyInterface() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
setBounds(10, 10, 800, 800);
|
setBounds(10, 10, 800, 800);
|
||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
|
|
@ -295,11 +303,25 @@ public class MyInterface extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showGameOverMessage(String message) {
|
public void showGameOverMessage(String message) {
|
||||||
JOptionPane.showMessageDialog(this, message, "Game Over", JOptionPane.INFORMATION_MESSAGE);
|
game.toggleAI(false);
|
||||||
game.toggleAI(false);
|
|
||||||
game.toggleAI(true);
|
game.toggleAI(true);
|
||||||
chckbxWhiteAI.setSelected(false);
|
chckbxWhiteAI.setSelected(false);
|
||||||
chckbxBlackAI.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() {
|
private int askDifficulty() {
|
||||||
|
|
@ -326,8 +348,8 @@ public class MyInterface extends JFrame {
|
||||||
Object[] options = {"1 min", "2 Min", "5 Min", "10 Min"};
|
Object[] options = {"1 min", "2 Min", "5 Min", "10 Min"};
|
||||||
int choice = JOptionPane.showOptionDialog(
|
int choice = JOptionPane.showOptionDialog(
|
||||||
this,
|
this,
|
||||||
"Select Difficulty Level:",
|
"Select the duration of the game:",
|
||||||
"Difficulty",
|
"Duration",
|
||||||
JOptionPane.DEFAULT_OPTION,
|
JOptionPane.DEFAULT_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
JOptionPane.QUESTION_MESSAGE,
|
||||||
null,
|
null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue