01: /*
02: * EscAction.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.actions;
13:
14: import java.awt.event.ActionEvent;
15: import java.awt.event.ActionListener;
16: import java.awt.event.KeyEvent;
17:
18: import javax.swing.ActionMap;
19: import javax.swing.InputMap;
20: import javax.swing.JComponent;
21: import javax.swing.KeyStroke;
22:
23: /**
24: * An action mapped to the ESC key
25: * @author support@sql-workbench.net
26: */
27: public class EscAction extends WbAction {
28: private ActionListener client;
29:
30: public EscAction(ActionListener aClient) {
31: super ();
32: this .client = aClient;
33: this .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,
34: 0));
35: }
36:
37: public void actionPerformed(ActionEvent e) {
38: e.setSource(this);
39: this.client.actionPerformed(e);
40: }
41:
42: }
|