1:
36:
37:
38: package ;
39:
40:
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;
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: }