2022-05-04 23:23:27 +02:00
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class EtatPartie extends JPanel {
|
|
|
|
// Définition du constructeur
|
2022-05-05 22:29:04 +02:00
|
|
|
public EtatPartie(int mines) {
|
2022-05-04 23:23:27 +02:00
|
|
|
super();
|
|
|
|
|
2022-05-05 23:13:52 +02:00
|
|
|
// On défini un style à la bannière
|
2022-05-04 23:23:27 +02:00
|
|
|
this.setBackground( new Color(0, 236, 96));
|
2022-05-05 23:13:52 +02:00
|
|
|
|
|
|
|
this.setSize(200,100);
|
2022-05-10 11:52:26 +02:00
|
|
|
// On ajoute le compteur de mines restantes
|
2022-05-05 22:29:04 +02:00
|
|
|
setMinesLeft(mines);
|
2022-05-05 23:13:52 +02:00
|
|
|
|
2022-05-04 23:23:27 +02:00
|
|
|
}
|
2022-05-05 22:29:04 +02:00
|
|
|
|
|
|
|
// Méthode pour afficher le nombre de mines restantes
|
2022-05-10 11:52:26 +02:00
|
|
|
public void setMinesLeft(int minesLeft){
|
2022-05-05 23:13:52 +02:00
|
|
|
this.removeAll();
|
2022-05-05 22:29:04 +02:00
|
|
|
this.add(new MineLeft(minesLeft,this.getSize()));
|
|
|
|
//System.out.println("Mines restantes : "+minesLeft);
|
|
|
|
this.repaint();
|
|
|
|
this.updateUI();
|
|
|
|
}
|
2022-05-04 23:23:27 +02:00
|
|
|
}
|