2022-05-21 17:53:19 +02:00
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class Banniere extends JPanel {
|
2022-05-21 22:17:25 +02:00
|
|
|
private FrameJeu fenetre;
|
2022-05-23 19:32:09 +02:00
|
|
|
private FrameMenu menu;
|
2022-05-21 17:53:19 +02:00
|
|
|
// Définition du constructeur
|
2022-05-23 19:32:09 +02:00
|
|
|
public Banniere(int mines, FrameJeu fenetre, FrameMenu menu) {
|
2022-05-21 17:53:19 +02:00
|
|
|
super();
|
2022-05-21 22:17:25 +02:00
|
|
|
this.fenetre=fenetre;
|
2022-05-23 19:32:09 +02:00
|
|
|
this.menu=menu;
|
2022-05-21 17:53:19 +02:00
|
|
|
|
|
|
|
// On défini un style à la bannière
|
2022-05-23 23:02:19 +02:00
|
|
|
this.setBackground(new Color(0, 236, 96));
|
2022-05-21 18:41:24 +02:00
|
|
|
|
2022-05-21 17:53:19 +02:00
|
|
|
// TODO : Bouton sauver et quitter
|
|
|
|
}
|
|
|
|
|
|
|
|
// Méthode pour afficher le nombre de mines restantes
|
|
|
|
public void setMinesLeft(int minesLeft){
|
|
|
|
this.removeAll();
|
2022-05-23 23:02:19 +02:00
|
|
|
this.add(new JLabel("Mines restantes : "+Integer.toString(minesLeft)));
|
2022-05-21 17:53:19 +02:00
|
|
|
this.repaint();
|
2022-05-21 18:41:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Méthode pour indiquer au joueur sa Victoire
|
|
|
|
public void setVictoire(){
|
2022-05-23 23:02:19 +02:00
|
|
|
this.add(new Fin("Victoire ! Retour au menu...",this.getSize()));
|
2022-05-21 18:41:24 +02:00
|
|
|
this.repaint();
|
2022-05-23 23:02:19 +02:00
|
|
|
Timer timerMenu = new Timer(5000, new MenuListener(this.fenetre, this.menu));
|
2022-05-23 16:10:45 +02:00
|
|
|
timerMenu.setRepeats(false);
|
|
|
|
timerMenu.start();
|
2022-05-21 18:41:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Méthode pour indiquer au joueur sa Défaite
|
|
|
|
public void setDefaite(){
|
2022-05-23 23:02:19 +02:00
|
|
|
this.add(new Fin("Défaite ! Retour au menu...",this.getSize()));
|
2022-05-23 16:10:45 +02:00
|
|
|
this.repaint();
|
2022-05-23 23:02:19 +02:00
|
|
|
Timer timerMenu = new Timer(5000, new MenuListener(this.fenetre, this.menu));
|
2022-05-23 16:10:45 +02:00
|
|
|
timerMenu.setRepeats(false);
|
|
|
|
timerMenu.start();
|
2022-05-21 17:53:19 +02:00
|
|
|
}
|
|
|
|
}
|