diff --git a/Case.java b/Case.java index 1207a83..6940816 100644 --- a/Case.java +++ b/Case.java @@ -1,31 +1,42 @@ import javax.swing.*; import java.awt.*; +public class Case extends JComponent { + private JPanel panel = new JPanel(); + private int entourage=0; + private boolean visible=false; + private boolean minee=false; -public class Case extends JComponent{ - private JPanel panel= new JPanel(); + public Case(Dimension caseSize, boolean visible, boolean minee, int entourage) { + super(); + this.panel.setSize(caseSize); + this.entourage=entourage; + this.visible=visible; + this.minee=minee; - public Case (Dimension caseSize, boolean visible, boolean minee){ - super(); - this.panel.setSize(caseSize); - if (visible==false){ - Color gray2 = new Color(70,70,70); - this.panel.setBackground(gray2); - } else if (visible==true){ - Color gray1 = new Color(80,80,80); - this.panel.setBackground(gray1); - if (minee==true){ - Color rose = new Color(236,0,140); - this.panel.setBackground(rose); - System.out.println("J'ai miné ! "); - } - } - - } + if (this.visible == false) { + Color gray2 = new Color(70, 70, 70); + this.panel.setBackground(gray2); + } else if (this.visible == true) { + Color gray1 = new Color(80, 80, 80); + this.panel.setBackground(gray1); + if (this.minee == true) { + Color rose = new Color(236, 0, 140); + this.panel.setBackground(rose); + } else if (this.entourage>0){ + System.out.println(""+ this.entourage); + } + } - public JPanel getCase(){ - return this.panel; - } + } + + @Override + protected void paintComponent(Graphics pinceau) { + System.out.println("coucou"); + } + + public JPanel getCase() { + return this.panel; + } - } diff --git a/Grille.java b/Grille.java index 76159bc..351c725 100644 --- a/Grille.java +++ b/Grille.java @@ -40,9 +40,6 @@ public class Grille extends JComponent { } } } - for (int i=0;i