TP Exceptions

This commit is contained in:
Simoes Lukas
2025-03-12 17:10:44 +01:00
parent 2a0aa37baa
commit cf33623a5d
45 changed files with 448 additions and 23 deletions

View File

@@ -4,10 +4,14 @@ import java.awt.*;
public class GestionSouris implements MouseListener {
private JLabel titre;
private JLabel2 titre;
private Fenetre fenetre;
private JLabel2 actif;
private boolean actuelEstActif;
public GestionSouris(JLabel titre) {
public GestionSouris(JLabel2 titre, Fenetre fenetre) {
this.titre = titre;
this.fenetre = fenetre;
}
public void mouseClicked(MouseEvent evenement) {
@@ -20,14 +24,35 @@ public class GestionSouris implements MouseListener {
}
public void mouseExited(MouseEvent evenement){
this.titre.setOpaque(true);
this.titre.setBackground(Color.WHITE);
this.titre.repaint();
if (!this.actuelEstActif) {
this.titre.setOpaque(true);
this.titre.setBackground(null);
this.titre.repaint();
}
else {
this.titre.setBackground(Color.LIGHT_GRAY);
this.titre.repaint();
}
}
public void mousePressed(MouseEvent evenement){
}
this.titre.setBackground(Color.LIGHT_GRAY);
this.actuelEstActif = true;
this.titre.repaint();
if (this.fenetre.getEstActif()) {
this.fenetre.getActif().setBackground(null);
this.fenetre.getActif().getGestionnaireSouris().setActuelEstActif(false);
this.fenetre.getActif().repaint();
}
this.fenetre.setEstActif(true);
this.fenetre.setActif(this.titre);
}
public void mouseReleased(MouseEvent evenement){
}
public void setActuelEstActif(boolean n) {
this.actuelEstActif = n;
}
}