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-21 17:53:19 +02:00
|
|
|
// Définition du constructeur
|
2022-05-21 22:17:25 +02:00
|
|
|
public Banniere(int mines, FrameJeu fenetre) {
|
2022-05-21 17:53:19 +02:00
|
|
|
super();
|
2022-05-21 22:17:25 +02:00
|
|
|
this.fenetre=fenetre;
|
2022-05-21 17:53:19 +02:00
|
|
|
|
|
|
|
// On défini un style à la bannière
|
|
|
|
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();
|
|
|
|
this.add(new MineLeft(minesLeft,this.getSize()));
|
|
|
|
this.repaint();
|
2022-05-21 18:41:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Méthode pour indiquer au joueur sa Victoire
|
|
|
|
public void setVictoire(){
|
|
|
|
this.add(new Fin("Victoire !",this.getSize()));
|
|
|
|
this.repaint();
|
2022-05-23 10:47:54 +02:00
|
|
|
try {
|
2022-05-23 12:56:40 +02:00
|
|
|
Thread.sleep(5000);
|
2022-05-23 10:47:54 +02:00
|
|
|
} catch (InterruptedException e){
|
|
|
|
System.out.println("oops you didn't see the end");
|
|
|
|
}
|
2022-05-21 23:01:08 +02:00
|
|
|
new FrameMenu();
|
|
|
|
this.fenetre.dispose();
|
2022-05-21 18:41:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Méthode pour indiquer au joueur sa Défaite
|
|
|
|
public void setDefaite(){
|
|
|
|
this.add(new Fin("Défaite !",this.getSize()));
|
2022-05-23 12:56:40 +02:00
|
|
|
this.repaint();try {
|
|
|
|
Thread.sleep(5000);
|
2022-05-23 10:47:54 +02:00
|
|
|
} catch (InterruptedException e){
|
|
|
|
System.out.println("oops you didn't see the end");
|
|
|
|
}
|
2022-05-21 23:01:08 +02:00
|
|
|
new FrameMenu();
|
|
|
|
this.fenetre.dispose();
|
2022-05-21 17:53:19 +02:00
|
|
|
}
|
|
|
|
}
|