From 1df06a10686f94bf114fe5e86cefc9d8014c1d1e Mon Sep 17 00:00:00 2001 From: gabrielshiraishi Date: Mon, 12 May 2025 11:20:38 +0200 Subject: [PATCH] Add of restart option for the start a new game --- OOP_2B1_Project/src/windowInterface/MyInterface.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OOP_2B1_Project/src/windowInterface/MyInterface.java b/OOP_2B1_Project/src/windowInterface/MyInterface.java index 7b17413..6d32ca3 100644 --- a/OOP_2B1_Project/src/windowInterface/MyInterface.java +++ b/OOP_2B1_Project/src/windowInterface/MyInterface.java @@ -307,18 +307,21 @@ public class MyInterface extends JFrame { game.toggleAI(true); chckbxWhiteAI.setSelected(false); chckbxBlackAI.setSelected(false); - Object[] options = {"YES", "NO"}; + Object[] options = {"YES", "NO", "Start a new game"}; 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 + options[1] // default: NO ); switch (choice) { - case 0: System.exit(0);; // Easy - case 1: ; // Medium + case 0: System.exit(0); // exit + case 1: ; + case 2: clicButtonStart(); + break; + default: ; }