diff --git a/Banniere.java b/Banniere.java new file mode 100644 index 0000000..5b7c955 --- /dev/null +++ b/Banniere.java @@ -0,0 +1,22 @@ +import javax.swing.*; +import java.awt.*; + +public class Banniere extends JPanel { + // Définition du constructeur + public Banniere(int mines) { + super(); + + // On défini un style à la bannière + this.setBackground( new Color(0, 236, 96)); + + // 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(); + this.updateUI(); + } +} \ No newline at end of file diff --git a/Case.java b/Case.java index f5f351e..42f8f9b 100644 --- a/Case.java +++ b/Case.java @@ -123,8 +123,6 @@ public class Case extends JPanel { // Methode pour savoir dans le Listener si la partie est finie ou non public boolean getEnJeu(){ - - System.out.println(this.grille.getEnJeu()); return this.grille.getEnJeu(); } } diff --git a/FrameJeu.java b/FrameJeu.java index f2ade32..8997cbc 100644 --- a/FrameJeu.java +++ b/FrameJeu.java @@ -20,7 +20,7 @@ public class FrameJeu extends JFrame{ Grille grille=new Grille(lignes,colonnes,mines); // Récupération de la bannière - EtatPartie banniere = grille.getBanniere(); + Banniere banniere = grille.getBanniere(); diff --git a/FrameMenu.java b/FrameMenu.java index 89dd24d..ca8070f 100644 --- a/FrameMenu.java +++ b/FrameMenu.java @@ -56,7 +56,7 @@ public class FrameMenu extends JFrame{ this.add(exit); - // A faire : Bouton charger + //TODO : Bouton charger this.setVisible(true); } diff --git a/Grille.java b/Grille.java index d49489d..570d675 100644 --- a/Grille.java +++ b/Grille.java @@ -3,7 +3,7 @@ import java.awt.*; import java.util.Random; public class Grille extends JPanel { - private EtatPartie banniere; + private Banniere banniere; private Dimension grilleSize=new Dimension(0,0); private Case[] plateau; private int colonnes; @@ -20,7 +20,7 @@ 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); - EtatPartie banniere = new EtatPartie(mines); + Banniere banniere = new Banniere(mines); banniere.setSize(grilleSize.width,grilleSize.height/8); this.setLayout(damier); this.setSize(grilleSize); @@ -188,6 +188,7 @@ public class Grille extends JPanel { } // Lance la victoire si toutes les cases non minées sont révélées if (taille-mines==casesVisibles){ + System.out.println("Victoire !"); for (int i=0;i