import java.awt.*;
import javax.swing.*;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;

public class WindowControler implements WindowListener {

	private Fenetre fenetre;

	public WindowControler(Fenetre fenetre) {
		this.fenetre = fenetre;
	}

	public void windowActivated(WindowEvent evenement) {

	}


	public void windowClosed(WindowEvent evenement) {

	}


	public void windowClosing(WindowEvent evenement) {
		int resultat = JOptionPane.showConfirmDialog(fenetre, null);
		if (resultat == JOptionPane.YES_OPTION) {
			fenetre.dispose();
		} 
	}        // avant fermeture


	public void windowDeactivated(WindowEvent evenement) {

	}   


	public void windowDeiconified(WindowEvent evenement) {

	}  


	public void windowIconified(WindowEvent evenement) {

	}      


	public void windowOpened(WindowEvent evenement) {

	}   
}