3c9d20ad
shaggy42089
nearly finished tp2
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package tp2.evenements;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class FermetureFenetre extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.out.println("Fenetre en cours de fermeture");
System.exit(0);
}
public static void main(String[] args) {
JFrame win = new JFrame();
win.addWindowListener(new FermetureFenetre());
win.setLocationRelativeTo(null);
win.setResizable(false);
win.pack();
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.setVisible(true);
}
}
|