modif JFrame => JPanel

This commit is contained in:
martins 2022-10-13 23:24:13 +02:00
parent fcdffb82f0
commit 3c39feaacc
2 changed files with 11 additions and 13 deletions

View File

@ -7,14 +7,12 @@ import fr.iutfbleau.projetAgile.View.*;
public class ObservateurMenuSouris implements MouseListener{
private BoutonsMenu bout;
private JFrame fenetre;
public ObservateurMenuSouris(BoutonsMenu boutons, JFrame fenetre0){
public ObservateurMenuSouris(BoutonsMenu boutons){
this.bout=boutons;
this.fenetre=fenetre0;
}
public void mouseClicked(MouseEvent evenement){
if(this.bout.getPath()=="puissance4.png"){
this.fenetre.dispose();
//a paramétrer
}
} // un bouton cliqué
public void mouseEntered(MouseEvent evenement){

View File

@ -42,17 +42,17 @@ public class Menu extends JPanel{
BoutonsMenu minecraft=new BoutonsMenu("minecraft.png");
BoutonsMenu puzzle=new BoutonsMenu("puzzle.png");
puissance_4.addMouseListener(new ObservateurMenuSouris(puissance_4, this));
echecs.addMouseListener(new ObservateurMenuSouris(echecs, this));
dames.addMouseListener(new ObservateurMenuSouris(dames, this));
puissance_4.addMouseListener(new ObservateurMenuSouris(puissance_4));
echecs.addMouseListener(new ObservateurMenuSouris(echecs));
dames.addMouseListener(new ObservateurMenuSouris(dames));
demineur.addMouseListener(new ObservateurMenuSouris(demineur, this));
taquin.addMouseListener(new ObservateurMenuSouris(taquin, this));
morpion.addMouseListener(new ObservateurMenuSouris(morpion, this));
demineur.addMouseListener(new ObservateurMenuSouris(demineur));
taquin.addMouseListener(new ObservateurMenuSouris(taquin));
morpion.addMouseListener(new ObservateurMenuSouris(morpion));
CoD.addMouseListener(new ObservateurMenuSouris(CoD, this));
minecraft.addMouseListener(new ObservateurMenuSouris(minecraft, this));
puzzle.addMouseListener(new ObservateurMenuSouris(puzzle, this));
CoD.addMouseListener(new ObservateurMenuSouris(CoD));
minecraft.addMouseListener(new ObservateurMenuSouris(minecraft));
puzzle.addMouseListener(new ObservateurMenuSouris(puzzle));
this.add(puissance_4, Menu.GridBagConstraintsRetour(0, 1));
this.add(echecs, Menu.GridBagConstraintsRetour(1, 1));