package fr.iutfbleau.projetAgile.Menu.Controller;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.awt.event.WindowEvent;

public class ObservateurFenetre implements WindowListener{
    private JFrame fenetre;
    public ObservateurFenetre(JFrame fenetre0){
        this.fenetre=fenetre0;
    }
    public void windowActivated(WindowEvent evenement){

    }      // premier plan
    public void windowClosed(WindowEvent evenement){

    }         // après fermeture
    public void windowClosing(WindowEvent evenement){
        int confirmation = JOptionPane.showConfirmDialog(this.fenetre.getContentPane(), "Etes-vous sûr de vouloir fermer la fenetre ?", "Quitter", JOptionPane.YES_NO_OPTION);
        if(confirmation != JOptionPane.OK_OPTION) return;
        this.fenetre.dispose();
    }        // avant fermeture
    public void windowDeactivated(WindowEvent evenement){

    }    // arrière-plan
    public void windowDeiconified(WindowEvent evenement){

    }    // restauration
    public void windowIconified(WindowEvent evenement){

    }      // minimisation
    public void windowOpened(WindowEvent evenement){

    }         // après ouverture
}
