From df2232c15538fc0377478a8bc75d002caa02c3a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 May 2022 19:53:32 +0200 Subject: [PATCH] correction Case --- Case.java | 25 ++++++++++--------------- FrameJeu.java | 2 +- Grille.java | 2 +- Listener.java | 5 ----- Test.java | 2 +- 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/Case.java b/Case.java index 3823f6d..e89fb1c 100644 --- a/Case.java +++ b/Case.java @@ -22,10 +22,19 @@ public class Case extends JPanel { GridLayout unique = new GridLayout(1,1); this.setLayout(unique); + this.setBackground(new Color(70, 70, 70)); } public void setVisible(){ this.visible=true; + if (this.minee == true) { + this.setBackground(new Color(236, 0, 140)); + } else { + this.setBackground(new Color(80, 80, 80)); + if (this.entourage>0){ + this.add(new Chiffre(entourage,caseSize)); + } + } this.updateUI(); } @@ -33,21 +42,7 @@ public class Case extends JPanel { return this.visible; } - public Case getCase(){ - if (this.visible == false) { - this.setBackground(new Color(70, 70, 70)); - } else if (this.visible == true) { - if (this.minee == true) { - this.setBackground(new Color(236, 0, 140)); - } else { - this.setBackground(new Color(80, 80, 80)); - if (this.entourage>0){ - this.add(new Chiffre(entourage,caseSize)); - } - } - } - return this; - } + public boolean getMine(){ return this.minee; diff --git a/FrameJeu.java b/FrameJeu.java index 48f2d36..93faa4c 100644 --- a/FrameJeu.java +++ b/FrameJeu.java @@ -3,7 +3,7 @@ import java.awt.*; // Cette classe à pour but d'afficher un menu et de réagir aux directives de l'utilisateur (lancer le jeu, le quitter...) public class FrameJeu{ - public FrameJeu(Grille grille, int mines) { + public FrameJeu(Grille grille) { // On récupère les dimensions de l'écran pour adapter la taille par défaut de notre fenêtre Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); diff --git a/Grille.java b/Grille.java index 04441de..0442197 100644 --- a/Grille.java +++ b/Grille.java @@ -267,7 +267,7 @@ public class Grille extends JPanel { protected void AfficherPlateau(int taille, Dimension caseSize, int[] entourage, boolean[] minee){ for (int i=0;i