correction Case
This commit is contained in:
parent
fd598eeb07
commit
df2232c155
19
Case.java
19
Case.java
@ -22,21 +22,11 @@ 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;
|
||||
this.updateUI();
|
||||
}
|
||||
|
||||
public boolean getVisible(){
|
||||
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 {
|
||||
@ -45,10 +35,15 @@ public class Case extends JPanel {
|
||||
this.add(new Chiffre(entourage,caseSize));
|
||||
}
|
||||
}
|
||||
this.updateUI();
|
||||
}
|
||||
return this;
|
||||
|
||||
public boolean getVisible(){
|
||||
return this.visible;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean getMine(){
|
||||
return this.minee;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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<taille;i++){
|
||||
this.plateau[i]= new Case(caseSize,minee[i],entourage[i]);
|
||||
this.add(this.plateau[i].getCase());
|
||||
this.add(this.plateau[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ public class Listener implements MouseListener{
|
||||
Case panel = (Case)evenement.getSource();
|
||||
if ((evenement.getButton() == MouseEvent.BUTTON1)&&(panel.getVisible()==false)&&(this.marquage==0)){
|
||||
panel.setVisible();
|
||||
panel.getCase();
|
||||
if (panel.getMine()==true){
|
||||
System.out.println("Perdu!");
|
||||
}
|
||||
@ -34,16 +33,12 @@ public class Listener implements MouseListener{
|
||||
}
|
||||
}
|
||||
public void mouseEntered(MouseEvent evenement){
|
||||
// System.out.println("mouseEntered");
|
||||
}
|
||||
public void mouseExited(MouseEvent evenement){
|
||||
// System.out.println("mouseExited");
|
||||
}
|
||||
public void mousePressed(MouseEvent evenement){
|
||||
// System.out.println("mousePressed");
|
||||
}
|
||||
public void mouseReleased(MouseEvent evenement){
|
||||
// System.out.println("mouseReleased");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user