diff --git a/EtatPartie.java b/EtatPartie.java index 591b8da..bec2aca 100644 --- a/EtatPartie.java +++ b/EtatPartie.java @@ -6,13 +6,17 @@ public class EtatPartie extends JPanel { public EtatPartie(int mines) { super(); - // On défini un style et une taille à la bannière + // On défini un style à la bannière this.setBackground( new Color(0, 236, 96)); + + this.setSize(200,100); setMinesLeft(mines); + } // Méthode pour afficher le nombre de mines restantes protected void setMinesLeft(int minesLeft){ + this.removeAll(); this.add(new MineLeft(minesLeft,this.getSize())); //System.out.println("Mines restantes : "+minesLeft); this.repaint(); diff --git a/Grille.java b/Grille.java index 8af56d9..95bb6bd 100644 --- a/Grille.java +++ b/Grille.java @@ -8,6 +8,7 @@ public class Grille extends JPanel { private Case[] plateau; private int taille; private int mines; + private int minesLeft; // Définition du constructeur qui correspond à une grille de jeu public Grille(EtatPartie banniere,int lignes, int colonnes, int mines){ @@ -17,8 +18,6 @@ public class Grille extends JPanel { this.grilleSize = new Dimension(((screenSize.height*3/4)/lignes)*colonnes, screenSize.height*3/4 ); Dimension caseSize = new Dimension(this.grilleSize.height/lignes,this.grilleSize.height/lignes); GridLayout damier = new GridLayout(lignes,colonnes); - System.out.println("Taille des cases : "+caseSize); - System.out.println("Taille de la Grille : "+grilleSize); this.setLayout(damier); this.setSize(grilleSize); this.taille=lignes*colonnes; @@ -152,13 +151,13 @@ public class Grille extends JPanel { // Méthode pour déterminer le nombre de mines restantes public void MinesLeft(){ - int minesLeft=this.mines; + this.minesLeft=this.mines; for (int i=0;i