SAE21_2021/CASE/observateurSAV.java

42 lines
1.0 KiB
Java
Raw Normal View History

2022-04-29 00:33:24 +02:00
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class observateurSAV implements MouseListener{
2022-04-29 14:20:40 +02:00
private plateau plat;
2022-04-29 00:33:24 +02:00
private paintMenuJeu button;
2022-04-29 14:20:40 +02:00
private boolean fonction;
public observateurSAV(paintMenuJeu button0, plateau plat0){
2022-04-29 00:33:24 +02:00
this.button=button0;
2022-04-29 14:20:40 +02:00
this.plat=plat0;
this.fonction=false;
}
public void setFonction(boolean fonction0){
this.fonction=fonction0;
2022-04-29 00:33:24 +02:00
}
@Override
public void mouseClicked(MouseEvent evenement){
2022-04-29 14:20:40 +02:00
if(this.fonction==false){
2022-05-05 01:41:54 +02:00
plat.save();
2022-04-29 14:20:40 +02:00
}
if(this.fonction==true){
2022-04-29 17:20:43 +02:00
plat.newGame(plat.getLigne(), plat.getCollonne(), plat.getBombe());
2022-04-29 14:20:40 +02:00
}
2022-04-29 00:33:24 +02:00
}
@Override // un bouton cliqué
public void mouseEntered(MouseEvent evenement){
this.button.setSurvol(true);
}
@Override // debut du survol
public void mouseExited(MouseEvent evenement){
this.button.setSurvol(false);
}
@Override // fin du survol
public void mousePressed(MouseEvent evenement){
}
@Override // un bouton appuyé
public void mouseReleased(MouseEvent evenement){
}
}