KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > swixml > converters > KeyEvent


1 /*--
2  $Id: KeyEvent.java,v 1.2 2005/05/31 04:51:43 wolfpaulus Exp $
3
4  Copyright (C) 2003-2004 Wolf Paulus.
5  All rights reserved.
6
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions
9  are met:
10
11  1. Redistributions of source code must retain the above copyright
12  notice, this list of conditions, and the following disclaimer.
13
14  2. Redistributions in binary form must reproduce the above copyright
15  notice, this list of conditions, and the disclaimer that follows
16  these conditions in the documentation and/or other materials provided
17  with the distribution.
18
19  3. The end-user documentation included with the redistribution,
20  if any, must include the following acknowledgment:
21         "This product includes software developed by the
22          SWIXML Project (http://www.swixml.org/)."
23  Alternately, this acknowledgment may appear in the software itself,
24  if and wherever such third-party acknowledgments normally appear.
25
26  4. The name "Swixml" must not be used to endorse or promote products
27  derived from this software without prior written permission. For
28  written permission, please contact <info_AT_swixml_DOT_org>
29
30  5. Products derived from this software may not be called "Swixml",
31  nor may "Swixml" appear in their name, without prior written
32  permission from the Swixml Project Management.
33
34  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
35  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
36  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37  DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
38  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
41  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
42  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
43  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
44  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45  SUCH DAMAGE.
46  ====================================================================
47
48  This software consists of voluntary contributions made by many
49  individuals on behalf of the Swixml Project and was originally
50  created by Wolf Paulus <wolf_AT_swixml_DOT_org>. For more information
51  on the Swixml Project, please see <http://www.swixml.org/>.
52 */

53
54 package org.swixml.converters;
55
56 /**
57  * The KeyEvent Interface makes the KeyEvents available to the converter objects
58  * @author <a HREF="mailto:wolf@paulus.com">Wolf Paulus</a>
59  * @version $Revision: 1.2 $
60  * @since
61  */

62
63 public interface KeyEvent {
64   /**
65    * The first number in the range of ids used for key events.
66    */

67   int KEY_FIRST = 400;
68   /**
69    * The last number in the range of ids used for key events.
70    */

71   int KEY_LAST = 402;
72   /**
73    * The "key typed" event. This event is generated when a character is
74    * entered. In the simplest case, it is produced by a single key press.
75    * Often, however, characters are produced by series of key presses, and
76    * the mapping from key pressed events to key typed events may be
77    * many-to-one or many-to-many.
78    */

79   int KEY_TYPED = KEY_FIRST;
80   /**
81    * The "key pressed" event. This event is generated when a key
82    * is pushed down.
83    */

84   int KEY_PRESSED = 1 + KEY_FIRST; //Event.KEY_PRESS
85
/**
86    * The "key released" event. This event is generated when a key
87    * is let up.
88    */

89   int KEY_RELEASED = 2 + KEY_FIRST; //Event.KEY_RELEASE
90
int VK_ENTER = '\n';
91   int VK_BACK_SPACE = '\b';
92   int VK_TAB = '\t';
93   int VK_CANCEL = 0x03;
94   int VK_CLEAR = 0x0C;
95   int VK_SHIFT = 0x10;
96   int VK_CONTROL = 0x11;
97   int VK_ALT = 0x12;
98   int VK_PAUSE = 0x13;
99   int VK_CAPS_LOCK = 0x14;
100   int VK_ESCAPE = 0x1B;
101   int VK_SPACE = 0x20;
102   int VK_PAGE_UP = 0x21;
103   int VK_PAGE_DOWN = 0x22;
104   int VK_END = 0x23;
105   int VK_HOME = 0x24;
106   /**
107    * Constant for the non-numpad <b>left</b> arrow key.
108    * @see #VK_KP_LEFT
109    */

110   int VK_LEFT = 0x25;
111   /**
112    * Constant for the non-numpad <b>up</b> arrow key.
113    * @see #VK_KP_UP
114    */

115   int VK_UP = 0x26;
116   /**
117    * Constant for the non-numpad <b>right</b> arrow key.
118    * @see #VK_KP_RIGHT
119    */

120   int VK_RIGHT = 0x27;
121   /**
122    * Constant for the non-numpad <b>down</b> arrow key.
123    * @see #VK_KP_DOWN
124    */

125   int VK_DOWN = 0x28;
126   int VK_COMMA = 0x2C;
127   /**
128    * Constant for the "-" key.
129    * @since 1.2
130    */

131   int VK_MINUS = 0x2D;
132   int VK_PERIOD = 0x2E;
133   int VK_SLASH = 0x2F;
134   /** VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
135   int VK_0 = 0x30;
136   int VK_1 = 0x31;
137   int VK_2 = 0x32;
138   int VK_3 = 0x33;
139   int VK_4 = 0x34;
140   int VK_5 = 0x35;
141   int VK_6 = 0x36;
142   int VK_7 = 0x37;
143   int VK_8 = 0x38;
144   int VK_9 = 0x39;
145   int VK_SEMICOLON = 0x3B;
146   int VK_EQUALS = 0x3D;
147   /** VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
148   int VK_A = 0x41;
149   int VK_B = 0x42;
150   int VK_C = 0x43;
151   int VK_D = 0x44;
152   int VK_E = 0x45;
153   int VK_F = 0x46;
154   int VK_G = 0x47;
155   int VK_H = 0x48;
156   int VK_I = 0x49;
157   int VK_J = 0x4A;
158   int VK_K = 0x4B;
159   int VK_L = 0x4C;
160   int VK_M = 0x4D;
161   int VK_N = 0x4E;
162   int VK_O = 0x4F;
163   int VK_P = 0x50;
164   int VK_Q = 0x51;
165   int VK_R = 0x52;
166   int VK_S = 0x53;
167   int VK_T = 0x54;
168   int VK_U = 0x55;
169   int VK_V = 0x56;
170   int VK_W = 0x57;
171   int VK_X = 0x58;
172   int VK_Y = 0x59;
173   int VK_Z = 0x5A;
174   int VK_OPEN_BRACKET = 0x5B;
175   int VK_BACK_SLASH = 0x5C;
176   int VK_CLOSE_BRACKET = 0x5D;
177   int VK_NUMPAD0 = 0x60;
178   int VK_NUMPAD1 = 0x61;
179   int VK_NUMPAD2 = 0x62;
180   int VK_NUMPAD3 = 0x63;
181   int VK_NUMPAD4 = 0x64;
182   int VK_NUMPAD5 = 0x65;
183   int VK_NUMPAD6 = 0x66;
184   int VK_NUMPAD7 = 0x67;
185   int VK_NUMPAD8 = 0x68;
186   int VK_NUMPAD9 = 0x69;
187   int VK_MULTIPLY = 0x6A;
188   int VK_ADD = 0x6B;
189   /**
190    * This constant is obsolete, and is included only for backwards compatibility.
191    */

192   int VK_SEPARATER = 0x6C;
193   /**
194    * Constant for the Numpad Separator key.
195    * @since 1.4
196    */

197   int VK_SEPARATOR = VK_SEPARATER;
198   int VK_SUBTRACT = 0x6D;
199   int VK_DECIMAL = 0x6E;
200   int VK_DIVIDE = 0x6F;
201   int VK_DELETE = 0x7F; /* ASCII DEL */
202   int VK_NUM_LOCK = 0x90;
203   int VK_SCROLL_LOCK = 0x91;
204   /** Constant for the F1 function key. */
205   int VK_F1 = 0x70;
206   /** Constant for the F2 function key. */
207   int VK_F2 = 0x71;
208   /** Constant for the F3 function key. */
209   int VK_F3 = 0x72;
210   /** Constant for the F4 function key. */
211   int VK_F4 = 0x73;
212   /** Constant for the F5 function key. */
213   int VK_F5 = 0x74;
214   /** Constant for the F6 function key. */
215   int VK_F6 = 0x75;
216   /** Constant for the F7 function key. */
217   int VK_F7 = 0x76;
218   /** Constant for the F8 function key. */
219   int VK_F8 = 0x77;
220   /** Constant for the F9 function key. */
221   int VK_F9 = 0x78;
222   /** Constant for the F10 function key. */
223   int VK_F10 = 0x79;
224   /** Constant for the F11 function key. */
225   int VK_F11 = 0x7A;
226   /** Constant for the F12 function key. */
227   int VK_F12 = 0x7B;
228   /* F13 - F24 are used on IBM 3270 keyboard; use random range for constants. */
229   int VK_F13 = 0xF000;
230   /**
231    * Constant for the F14 function key.
232    * @since 1.2
233    */

234   int VK_F14 = 0xF001;
235   /**
236    * Constant for the F15 function key.
237    * @since 1.2
238    */

239   int VK_F15 = 0xF002;
240   /**
241    * Constant for the F16 function key.
242    * @since 1.2
243    */

244   int VK_F16 = 0xF003;
245   /**
246    * Constant for the F17 function key.
247    * @since 1.2
248    */

249   int VK_F17 = 0xF004;
250   /**
251    * Constant for the F18 function key.
252    * @since 1.2
253    */

254   int VK_F18 = 0xF005;
255   /**
256    * Constant for the F19 function key.
257    * @since 1.2
258    */

259   int VK_F19 = 0xF006;
260   /**
261    * Constant for the F20 function key.
262    * @since 1.2
263    */

264   int VK_F20 = 0xF007;
265   /**
266    * Constant for the F21 function key.
267    * @since 1.2
268    */

269   int VK_F21 = 0xF008;
270   /**
271    * Constant for the F22 function key.
272    * @since 1.2
273    */

274   int VK_F22 = 0xF009;
275   /**
276    * Constant for the F23 function key.
277    * @since 1.2
278    */

279   int VK_F23 = 0xF00A;
280   /**
281    * Constant for the F24 function key.
282    * @since 1.2
283    */

284   int VK_F24 = 0xF00B;
285   int VK_PRINTSCREEN = 0x9A;
286   int VK_INSERT = 0x9B;
287   int VK_HELP = 0x9C;
288   int VK_META = 0x9D;
289   int VK_BACK_QUOTE = 0xC0;
290   int VK_QUOTE = 0xDE;
291   /**
292    * Constant for the numeric keypad <b>up</b> arrow key.
293    * @see #VK_UP
294    * @since 1.2
295    */

296   int VK_KP_UP = 0xE0;
297   /**
298    * Constant for the numeric keypad <b>down</b> arrow key.
299    * @see #VK_DOWN
300    * @since 1.2
301    */

302   int VK_KP_DOWN = 0xE1;
303   /**
304    * Constant for the numeric keypad <b>left</b> arrow key.
305    * @see #VK_LEFT
306    * @since 1.2
307    */

308   int VK_KP_LEFT = 0xE2;
309   /**
310    * Constant for the numeric keypad <b>right</b> arrow key.
311    * @see #VK_RIGHT
312    * @since 1.2
313    */

314   int VK_KP_RIGHT = 0xE3;
315   /** @since 1.2 */
316   int VK_DEAD_GRAVE = 0x80;
317   /** @since 1.2 */
318   int VK_DEAD_ACUTE = 0x81;
319   /** @since 1.2 */
320   int VK_DEAD_CIRCUMFLEX = 0x82;
321   /** @since 1.2 */
322   int VK_DEAD_TILDE = 0x83;
323   /** @since 1.2 */
324   int VK_DEAD_MACRON = 0x84;
325   /** @since 1.2 */
326   int VK_DEAD_BREVE = 0x85;
327   /** @since 1.2 */
328   int VK_DEAD_ABOVEDOT = 0x86;
329   /** @since 1.2 */
330   int VK_DEAD_DIAERESIS = 0x87;
331   /** @since 1.2 */
332   int VK_DEAD_ABOVERING = 0x88;
333   /** @since 1.2 */
334   int VK_DEAD_DOUBLEACUTE = 0x89;
335   /** @since 1.2 */
336   int VK_DEAD_CARON = 0x8a;
337   /** @since 1.2 */
338   int VK_DEAD_CEDILLA = 0x8b;
339   /** @since 1.2 */
340   int VK_DEAD_OGONEK = 0x8c;
341   /** @since 1.2 */
342   int VK_DEAD_IOTA = 0x8d;
343   /** @since 1.2 */
344   int VK_DEAD_VOICED_SOUND = 0x8e;
345   /** @since 1.2 */
346   int VK_DEAD_SEMIVOICED_SOUND = 0x8f;
347   /** @since 1.2 */
348   int VK_AMPERSAND = 0x96;
349   /** @since 1.2 */
350   int VK_ASTERISK = 0x97;
351   /** @since 1.2 */
352   int VK_QUOTEDBL = 0x98;
353   /** @since 1.2 */
354   int VK_LESS = 0x99;
355   /** @since 1.2 */
356   int VK_GREATER = 0xa0;
357   /** @since 1.2 */
358   int VK_BRACELEFT = 0xa1;
359   /** @since 1.2 */
360   int VK_BRACERIGHT = 0xa2;
361   /**
362    * Constant for the "@" key.
363    * @since 1.2
364    */

365   int VK_AT = 0x0200;
366   /**
367    * Constant for the ":" key.
368    * @since 1.2
369    */

370   int VK_COLON = 0x0201;
371   /**
372    * Constant for the "^" key.
373    * @since 1.2
374    */

375   int VK_CIRCUMFLEX = 0x0202;
376   /**
377    * Constant for the "$" key.
378    * @since 1.2
379    */

380   int VK_DOLLAR = 0x0203;
381   /**
382    * Constant for the Euro currency sign key.
383    * @since 1.2
384    */

385   int VK_EURO_SIGN = 0x0204;
386   /**
387    * Constant for the "!" key.
388    * @since 1.2
389    */

390   int VK_EXCLAMATION_MARK = 0x0205;
391   /**
392    * Constant for the inverted exclamation mark key.
393    * @since 1.2
394    */

395   int VK_INVERTED_EXCLAMATION_MARK = 0x0206;
396   /**
397    * Constant for the "(" key.
398    * @since 1.2
399    */

400   int VK_LEFT_PARENTHESIS = 0x0207;
401   /**
402    * Constant for the "#" key.
403    * @since 1.2
404    */

405   int VK_NUMBER_SIGN = 0x0208;
406   /**
407    * Constant for the "+" key.
408    * @since 1.2
409    */

410   int VK_PLUS = 0x0209;
411   /**
412    * Constant for the ")" key.
413    * @since 1.2
414    */

415   int VK_RIGHT_PARENTHESIS = 0x020A;
416   /**
417    * Constant for the "_" key.
418    * @since 1.2
419    */

420   int VK_UNDERSCORE = 0x020B;
421   /* not clear what this means - listed in Microsoft Windows API */
422   int VK_FINAL = 0x0018;
423   /* Japanese PC 106 keyboard, Japanese Solaris keyboard: henkan */
424   int VK_CONVERT = 0x001C;
425   /* Japanese PC 106 keyboard: muhenkan */
426   int VK_NONCONVERT = 0x001D;
427   /* Japanese Solaris keyboard: kakutei */
428   int VK_ACCEPT = 0x001E;
429   /* not clear what this means - listed in Microsoft Windows API */
430   int VK_MODECHANGE = 0x001F;
431   /* replaced by VK_KANA_LOCK for Microsoft Windows and Solaris;
432        might still be used on other platforms */

433   int VK_KANA = 0x0015;
434   /* replaced by VK_INPUT_METHOD_ON_OFF for Microsoft Windows and Solaris;
435        might still be used for other platforms */

436   int VK_KANJI = 0x0019;
437   /* Japanese PC 106 keyboard: eisuu */
438   int VK_ALPHANUMERIC = 0x00F0;
439   /* Japanese PC 106 keyboard: katakana */
440   int VK_KATAKANA = 0x00F1;
441   /* Japanese PC 106 keyboard: hiragana */
442   int VK_HIRAGANA = 0x00F2;
443   /* Japanese PC 106 keyboard: zenkaku */
444   int VK_FULL_WIDTH = 0x00F3;
445   /* Japanese PC 106 keyboard: hankaku */
446   int VK_HALF_WIDTH = 0x00F4;
447   /* Japanese PC 106 keyboard: roumaji */
448   int VK_ROMAN_CHARACTERS = 0x00F5;
449   /* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */
450   int VK_ALL_CANDIDATES = 0x0100;
451   /* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */
452   int VK_PREVIOUS_CANDIDATE = 0x0101;
453   /* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */
454   int VK_CODE_INPUT = 0x0102;
455   /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
456   int VK_JAPANESE_KATAKANA = 0x0103;
457   /* Japanese Macintosh keyboard */
458   int VK_JAPANESE_HIRAGANA = 0x0104;
459   /* Japanese Macintosh keyboard */
460   int VK_JAPANESE_ROMAN = 0x0105;
461   /* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */
462   int VK_KANA_LOCK = 0x0106;
463   /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
464   int VK_INPUT_METHOD_ON_OFF = 0x0107;
465   /** @since 1.2 */
466   int VK_CUT = 0xFFD1;
467   /** @since 1.2 */
468   int VK_COPY = 0xFFCD;
469   /** @since 1.2 */
470   int VK_PASTE = 0xFFCF;
471   /** @since 1.2 */
472   int VK_UNDO = 0xFFCB;
473   /** @since 1.2 */
474   int VK_AGAIN = 0xFFC9;
475   /** @since 1.2 */
476   int VK_FIND = 0xFFD0;
477   /** @since 1.2 */
478   int VK_PROPS = 0xFFCA;
479   /** @since 1.2 */
480   int VK_STOP = 0xFFC8;
481   /**
482    * Constant for the Compose function key.
483    * @since 1.2
484    */

485   int VK_COMPOSE = 0xFF20;
486   /**
487    * Constant for the AltGraph function key.
488    * @since 1.2
489    */

490   int VK_ALT_GRAPH = 0xFF7E;
491   /**
492    * This value is used to indicate that the keyCode is unknown.
493    * KEY_TYPED events do not have a keyCode value; this value
494    * is used instead.
495    */

496   int VK_UNDEFINED = 0x0;
497   /**
498    * KEY_PRESSED and KEY_RELEASED events which do not map to a
499    * valid Unicode character use this for the keyChar value.
500    */

501   char CHAR_UNDEFINED = 0xFFFF;
502   /**
503    * A constant indicating that the keyLocation is indeterminate
504    * or not relevant.
505    * KEY_TYPED events do not have a keyLocation; this value
506    * is used instead.
507    * @since 1.4
508    */

509   int KEY_LOCATION_UNKNOWN = 0;
510   /**
511    * A constant indicating that the key pressed or released
512    * is not distinguished as the left or right version of a key,
513    * and did not originate on the numeric keypad (or did not
514    * originate with a virtual key corresponding to the numeric
515    * keypad).
516    * @since 1.4
517    */

518   int KEY_LOCATION_STANDARD = 1;
519   /**
520    * A constant indicating that the key pressed or released is in
521    * the left key location (there is more than one possible location
522    * for this key). Example: the left shift key.
523    * @since 1.4
524    */

525   int KEY_LOCATION_LEFT = 2;
526   /**
527    * A constant indicating that the key pressed or released is in
528    * the right key location (there is more than one possible location
529    * for this key). Example: the right shift key.
530    * @since 1.4
531    */

532   int KEY_LOCATION_RIGHT = 3;
533   /**
534    * A constant indicating that the key event originated on the
535    * numeric keypad or with a virtual key corresponding to the
536    * numeric keypad.
537    * @since 1.4
538    */

539   int KEY_LOCATION_NUMPAD = 4;
540 }
541
Popular Tags