blob: 921fe57443e8e4609b1773bb889dd089aa354f5e (
plain)
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
30
31
32
33
34
35
36
37
38
|
/* WindowClosingAdapter.java */
import java.awt.*;
import java.awt.event.*;
public class WindowClosingAdapter
extends WindowAdapter
{
private boolean exitSystem;
/**
* Erzeugt einen WindowClosingAdapter zum Schliessen
* des Fensters. Ist exitSystem true, wird das komplette
* Programm beendet.
*/
public WindowClosingAdapter(boolean exitSystem)
{
this.exitSystem = exitSystem;
}
/**
* Erzeugt einen WindowClosingAdapter zum Schliessen
* des Fensters. Das Programm wird nicht beendet.
*/
public WindowClosingAdapter()
{
this(false);
}
public void windowClosing(WindowEvent event)
{
event.getWindow().setVisible(false);
event.getWindow().dispose();
if (exitSystem) {
System.exit(0);
}
}
}
|