push
This commit is contained in:
BIN
DEV2.1/CTRLBLANC/Exo5/Fermeture.class
Normal file
BIN
DEV2.1/CTRLBLANC/Exo5/Fermeture.class
Normal file
Binary file not shown.
21
DEV2.1/CTRLBLANC/Exo5/Fermeture.java
Normal file
21
DEV2.1/CTRLBLANC/Exo5/Fermeture.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
|
||||
public class Fermeture{
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(800, 800);
|
||||
Oui yeet = new Oui();
|
||||
while(yeet.checkVrai()!= true){
|
||||
fenetre.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.addWindowListener(yeet);
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
BIN
DEV2.1/CTRLBLANC/Exo5/Oui.class
Normal file
BIN
DEV2.1/CTRLBLANC/Exo5/Oui.class
Normal file
Binary file not shown.
28
DEV2.1/CTRLBLANC/Exo5/Oui.java
Normal file
28
DEV2.1/CTRLBLANC/Exo5/Oui.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Oui implements WindowListener{
|
||||
private int a;
|
||||
public Oui(){
|
||||
super();
|
||||
this.a=0;
|
||||
}
|
||||
public void windowActivated(WindowEvent evenement){} // premier plan
|
||||
public void windowClosed(WindowEvent evenement){} // après fermeture
|
||||
public void windowClosing(WindowEvent evenement){} // avant fermeture
|
||||
public void windowDeactivated(WindowEvent evenement){} // arrière-plan
|
||||
public void windowDeiconified(WindowEvent evenement){} // restauration
|
||||
public void windowOpened(WindowEvent evenement){}
|
||||
public void windowIconified(WindowEvent e){
|
||||
this.a=1;
|
||||
}
|
||||
public boolean checkVrai(){
|
||||
if (this.a == 1){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user