ajout d'un menu de fin et de pouvoir quitter
This commit is contained in:
@@ -55,14 +55,19 @@ public class ArenaWindow extends JFrame {
|
||||
JButton startButton = new JButton("Lancer les parties");
|
||||
startButton.addActionListener(e -> showConfigDialog());
|
||||
buttonPanel.add(startButton);
|
||||
|
||||
|
||||
JButton backButton = new JButton("Retour au menu");
|
||||
backButton.addActionListener(e -> {
|
||||
dispose(); // Ferme la fenêtre Arène
|
||||
Main.showModeSelection(); // Affiche le menu principal
|
||||
});
|
||||
buttonPanel.add(backButton);
|
||||
|
||||
|
||||
// Nouveau bouton pour quitter entièrement le jeu
|
||||
JButton quitButton = new JButton("Quitter");
|
||||
quitButton.addActionListener(e -> System.exit(0));
|
||||
buttonPanel.add(quitButton);
|
||||
|
||||
add(buttonPanel, BorderLayout.SOUTH);
|
||||
|
||||
pack();
|
||||
@@ -226,13 +231,22 @@ public class ArenaWindow extends JFrame {
|
||||
}
|
||||
}
|
||||
|
||||
// Afficher un message de fin
|
||||
JOptionPane.showMessageDialog(
|
||||
// Afficher un message de fin avec possibilité de quitter directement
|
||||
Object[] options = {"OK", "Quitter le jeu"};
|
||||
int choice = JOptionPane.showOptionDialog(
|
||||
this,
|
||||
"Toutes les parties sont terminées !",
|
||||
"Arène terminée",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.INFORMATION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0]
|
||||
);
|
||||
|
||||
if (choice == 1) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user