37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
|
//Fonction permettant d'observer les action realiser sur la fenetre et notament pour
|
||
|
//sauvegarder avant la fermeture de celle-di
|
||
|
import java.awt.event.*;
|
||
|
|
||
|
public class observateurFenetre implements WindowListener{
|
||
|
private plateau plat;
|
||
|
public observateurFenetre(plateau plat0){
|
||
|
this.plat=plat0;
|
||
|
}
|
||
|
|
||
|
public void windowActivated(WindowEvent evenement){
|
||
|
|
||
|
} // premier plan
|
||
|
public void windowClosed(WindowEvent evenement){
|
||
|
|
||
|
} // après fermeture
|
||
|
public void windowClosing(WindowEvent evenement){
|
||
|
//si le joueur veut fermer la fenetre
|
||
|
//si la partie n'est pas encore fini
|
||
|
if(this.plat.etatDeVictoire()==0){
|
||
|
//on sauvegarde
|
||
|
this.plat.save();
|
||
|
}
|
||
|
} // 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
|
||
|
}
|