1 |
14 |
jlechner |
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
2 |
|
|
|
3 |
|
|
This file is part of GNU Classpath.
|
4 |
|
|
|
5 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
6 |
|
|
it under the terms of the GNU General Public License as published by
|
7 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
8 |
|
|
any later version.
|
9 |
|
|
|
10 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
11 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 |
|
|
General Public License for more details.
|
14 |
|
|
|
15 |
|
|
You should have received a copy of the GNU General Public License
|
16 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
17 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
18 |
|
|
02110-1301 USA.
|
19 |
|
|
|
20 |
|
|
Linking this library statically or dynamically with other modules is
|
21 |
|
|
making a combined work based on this library. Thus, the terms and
|
22 |
|
|
conditions of the GNU General Public License cover the whole
|
23 |
|
|
combination.
|
24 |
|
|
|
25 |
|
|
As a special exception, the copyright holders of this library give you
|
26 |
|
|
permission to link this library with independent modules to produce an
|
27 |
|
|
executable, regardless of the license terms of these independent
|
28 |
|
|
modules, and to copy and distribute the resulting executable under
|
29 |
|
|
terms of your choice, provided that you also meet, for each linked
|
30 |
|
|
independent module, the terms and conditions of the license of that
|
31 |
|
|
module. An independent module is a module which is not derived from
|
32 |
|
|
or based on this library. If you modify this library, you may extend
|
33 |
|
|
this exception to your version of the library, but you are not
|
34 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
35 |
|
|
exception statement from your version. */
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
package java.awt;
|
39 |
|
|
|
40 |
|
|
/**
|
41 |
|
|
* Written using on-line Java Platform 1.2 API Specification, as well
|
42 |
|
|
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
43 |
|
|
* Status: Believed complete and correct.
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
public class Event implements java.io.Serializable
|
47 |
|
|
{
|
48 |
|
|
static final long serialVersionUID = 5488922509400504703L;
|
49 |
|
|
|
50 |
|
|
public static final int SHIFT_MASK = 1;
|
51 |
|
|
public static final int CTRL_MASK = 2;
|
52 |
|
|
public static final int META_MASK = 4;
|
53 |
|
|
public static final int ALT_MASK = 8;
|
54 |
|
|
|
55 |
|
|
public static final int ACTION_EVENT = 1001;
|
56 |
|
|
public static final int BACK_SPACE = 8;
|
57 |
|
|
public static final int CAPS_LOCK = 1022;
|
58 |
|
|
public static final int DELETE = 127;
|
59 |
|
|
public static final int DOWN = 1005;
|
60 |
|
|
public static final int END = 1001;
|
61 |
|
|
public static final int ENTER = 10;
|
62 |
|
|
public static final int ESCAPE = 27;
|
63 |
|
|
public static final int F1 = 1008;
|
64 |
|
|
public static final int F10 = 1017;
|
65 |
|
|
public static final int F11 = 1018;
|
66 |
|
|
public static final int F12 = 1019;
|
67 |
|
|
public static final int F2 = 1009;
|
68 |
|
|
public static final int F3 = 1010;
|
69 |
|
|
public static final int F4 = 1011;
|
70 |
|
|
public static final int F5 = 1012;
|
71 |
|
|
public static final int F6 = 1013;
|
72 |
|
|
public static final int F7 = 1014;
|
73 |
|
|
public static final int F8 = 1015;
|
74 |
|
|
public static final int F9 = 1016;
|
75 |
|
|
public static final int GOT_FOCUS = 1004;
|
76 |
|
|
public static final int HOME = 1000;
|
77 |
|
|
public static final int INSERT = 1025;
|
78 |
|
|
public static final int KEY_ACTION = 403;
|
79 |
|
|
public static final int KEY_ACTION_RELEASE = 404;
|
80 |
|
|
public static final int KEY_PRESS = 401;
|
81 |
|
|
public static final int KEY_RELEASE = 402;
|
82 |
|
|
public static final int LEFT = 1006;
|
83 |
|
|
public static final int LIST_DESELECT = 702;
|
84 |
|
|
public static final int LIST_SELECT = 701;
|
85 |
|
|
public static final int LOAD_FILE = 1002;
|
86 |
|
|
public static final int LOST_FOCUS = 1005;
|
87 |
|
|
public static final int MOUSE_DOWN = 501;
|
88 |
|
|
public static final int MOUSE_DRAG = 506;
|
89 |
|
|
public static final int MOUSE_ENTER = 504;
|
90 |
|
|
public static final int MOUSE_EXIT = 505;
|
91 |
|
|
public static final int MOUSE_MOVE = 503;
|
92 |
|
|
public static final int MOUSE_UP = 502;
|
93 |
|
|
public static final int NUM_LOCK = 1023;
|
94 |
|
|
public static final int PAUSE = 1024;
|
95 |
|
|
public static final int PGDN = 1003;
|
96 |
|
|
public static final int PGUP = 1002;
|
97 |
|
|
public static final int PRINT_SCREEN = 1020;
|
98 |
|
|
public static final int RIGHT = 1007;
|
99 |
|
|
public static final int SAVE_FILE = 1003;
|
100 |
|
|
public static final int SCROLL_ABSOLUTE = 605;
|
101 |
|
|
public static final int SCROLL_BEGIN = 606;
|
102 |
|
|
public static final int SCROLL_END = 607;
|
103 |
|
|
public static final int SCROLL_LINE_DOWN = 602;
|
104 |
|
|
public static final int SCROLL_LINE_UP = 601;
|
105 |
|
|
public static final int SCROLL_LOCK = 1021;
|
106 |
|
|
public static final int SCROLL_PAGE_DOWN = 604;
|
107 |
|
|
public static final int SCROLL_PAGE_UP = 603;
|
108 |
|
|
public static final int TAB = 9;
|
109 |
|
|
public static final int UP = 1004;
|
110 |
|
|
public static final int WINDOW_DEICONIFY = 204;
|
111 |
|
|
public static final int WINDOW_DESTROY = 201;
|
112 |
|
|
public static final int WINDOW_EXPOSE = 202;
|
113 |
|
|
public static final int WINDOW_ICONIFY = 203;
|
114 |
|
|
public static final int WINDOW_MOVED = 205;
|
115 |
|
|
|
116 |
|
|
public Object arg;
|
117 |
|
|
public int clickCount;
|
118 |
|
|
boolean consumed; // Required by serialization spec.
|
119 |
|
|
public Event evt;
|
120 |
|
|
public int id;
|
121 |
|
|
public int key;
|
122 |
|
|
public int modifiers;
|
123 |
|
|
public Object target;
|
124 |
|
|
public long when;
|
125 |
|
|
public int x;
|
126 |
|
|
public int y;
|
127 |
|
|
|
128 |
|
|
public Event (Object target, int id, Object arg)
|
129 |
|
|
{
|
130 |
|
|
this.id = id;
|
131 |
|
|
this.target = target;
|
132 |
|
|
this.arg = arg;
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
public Event (Object target, long when, int id, int x, int y, int key,
|
136 |
|
|
int modifiers)
|
137 |
|
|
{
|
138 |
|
|
this.target = target;
|
139 |
|
|
this.when = when;
|
140 |
|
|
this.id = id;
|
141 |
|
|
this.x = x;
|
142 |
|
|
this.y = y;
|
143 |
|
|
this.key = key;
|
144 |
|
|
this.modifiers = modifiers;
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
public Event (Object target, long when, int id, int x, int y, int key,
|
148 |
|
|
int modifiers, Object arg)
|
149 |
|
|
{
|
150 |
|
|
this (target, when, id, x, y, key, modifiers);
|
151 |
|
|
this.arg = arg;
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
public boolean controlDown ()
|
155 |
|
|
{
|
156 |
|
|
return ((modifiers & CTRL_MASK) == 0 ? false : true);
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
public boolean metaDown ()
|
160 |
|
|
{
|
161 |
|
|
return ((modifiers & META_MASK) == 0 ? false : true);
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
protected String paramString ()
|
165 |
|
|
{
|
166 |
|
|
return "id=" + id + ",x=" + x + ",y=" + y
|
167 |
|
|
+ ",target=" + target + ",arg=" + arg;
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
public boolean shiftDown()
|
171 |
|
|
{
|
172 |
|
|
return ((modifiers & SHIFT_MASK) == 0 ? false : true);
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
public String toString()
|
176 |
|
|
{
|
177 |
|
|
return getClass().getName() + "[" + paramString() + "]";
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
public void translate (int x, int y)
|
181 |
|
|
{
|
182 |
|
|
this.x += x;
|
183 |
|
|
this.y += y;
|
184 |
|
|
}
|
185 |
|
|
}
|