1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.aequo.action;
14
15 import java.awt.event.ActionEvent;
16 import java.awt.event.KeyEvent;
17
18 import javax.swing.Action;
19 import javax.swing.JFrame;
20 import javax.swing.KeyStroke;
21
22
23
24
25
26
27 public class CloseWindowAction extends BaseAction {
28
29
30 protected JFrame window;
31
32 public CloseWindowAction() {
33 setName("Close");
34 setMessage("Close window");
35 setDescription("Close window");
36 putValue(Action.MNEMONIC_KEY, KeyEvent.VK_ESCAPE);
37 putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
38 }
39
40
41
42
43
44 public void setWindow(JFrame window) {
45 this.window = window;
46 }
47
48
49
50
51
52
53 public void perform(ActionEvent e) {
54 window.dispose();
55 }
56
57
58 }