SAE21_2021/Listener.java

37 lines
1.0 KiB
Java
Raw Normal View History

2022-04-30 16:38:56 +02:00
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Listener implements MouseListener{
@Override
public void mouseClicked(MouseEvent evenement){
Case panel = (Case)evenement.getSource();
if ((evenement.getButton() == MouseEvent.BUTTON1)&&(panel.getVisible()==false)){
panel.setVisible();
panel.getCase();
if (panel.getMine()==true){
System.out.println("Perdu!");
}
}
if (evenement.getButton() == MouseEvent.BUTTON3) {
panel.add(new Etoile(panel.getSize()), BorderLayout.CENTER);
panel.updateUI();
System.out.println("Marquage");
}
2022-04-30 16:38:56 +02:00
}
public void mouseEntered(MouseEvent evenement){
// System.out.println("mouseEntered");
2022-04-30 16:38:56 +02:00
}
public void mouseExited(MouseEvent evenement){
// System.out.println("mouseExited");
2022-04-30 16:38:56 +02:00
}
public void mousePressed(MouseEvent evenement){
// System.out.println("mousePressed");
2022-04-30 16:38:56 +02:00
}
public void mouseReleased(MouseEvent evenement){
// System.out.println("mouseReleased");
2022-04-30 16:38:56 +02:00
}
}