Spec-Zone .ru
спецификации, руководства, описания, API
001/*
002 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.  Oracle designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Oracle in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
022 * or visit www.oracle.com if you need additional information or have any
023 * questions.
024 */
025
026package javafx.scene.input;
027
028import java.util.HashMap;
029import java.util.Map;
030
031/**
032 * Set of key codes for {@link KeyEvent} objects.
033 */
034public enum KeyCode {
035
036    /**
037     * Constant for the {@code Enter} key.
038     */
039    ENTER(0x0A, "Enter", KeyCodeClass.WHITESPACE),
040
041    /**
042     * Constant for the {@code Backspace} key.
043     */
044    BACK_SPACE(0x08, "Backspace"),
045
046    /**
047     * Constant for the {@code Tab} key.
048     */
049    TAB(0x09, "Tab", KeyCodeClass.WHITESPACE),
050
051    /**
052     * Constant for the {@code Cancel} key.
053     */
054    CANCEL(0x03, "Cancel"),
055
056    /**
057     * Constant for the {@code Clear} key.
058     */
059    CLEAR(0x0C, "Clear"),
060
061    /**
062     * Constant for the {@code Shift} key.
063     */
064    SHIFT(0x10, "Shift", KeyCodeClass.MODIFIER),
065
066    /**
067     * Constant for the {@code Ctrl} key.
068     */
069    CONTROL(0x11, "Ctrl", KeyCodeClass.MODIFIER),
070
071    /**
072     * Constant for the {@code Alt} key.
073     */
074    ALT(0x12, "Alt", KeyCodeClass.MODIFIER),
075
076    /**
077     * Constant for the {@code Pause} key.
078     */
079    PAUSE(0x13, "Pause"),
080
081    /**
082     * Constant for the {@code Caps Lock} key.
083     */
084    CAPS(0x14, "Caps Lock"),
085
086    /**
087     * Constant for the {@code Esc} key.
088     */
089    ESCAPE(0x1B, "Esc"),
090
091    /**
092     * Constant for the {@code Space} key.
093     */
094    SPACE(0x20, "Space", KeyCodeClass.WHITESPACE),
095
096    /**
097     * Constant for the {@code Page Up} key.
098     */
099    PAGE_UP(0x21, "Page Up", KeyCodeClass.NAVIGATION),
100
101    /**
102     * Constant for the {@code Page Down} key.
103     */
104    PAGE_DOWN(0x22, "Page Down", KeyCodeClass.NAVIGATION),
105
106    /**
107     * Constant for the {@code End} key.
108     */
109    END(0x23, "End", KeyCodeClass.NAVIGATION),
110
111    /**
112     * Constant for the {@code Home} key.
113     */
114    HOME(0x24, "Home", KeyCodeClass.NAVIGATION),
115
116    /**
117     * Constant for the non-numpad <b>left</b> arrow key.
118     */
119    LEFT(0x25, "Left", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION),
120
121    /**
122     * Constant for the non-numpad <b>up</b> arrow key.
123     */
124    UP(0x26, "Up", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION),
125
126    /**
127     * Constant for the non-numpad <b>right</b> arrow key.
128     */
129    RIGHT(0x27, "Right", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION),
130
131    /**
132     * Constant for the non-numpad <b>down</b> arrow key.
133     */
134    DOWN(0x28, "Down", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION),
135
136    /**
137     * Constant for the comma key, ","
138     */
139    COMMA(0x2C, "Comma"),
140
141    /**
142     * Constant for the minus key, "-"
143     */
144    MINUS(0x2D, "Minus"),
145
146    /**
147     * Constant for the period key, "."
148     */
149    PERIOD(0x2E, "Period"),
150
151    /**
152     * Constant for the forward slash key, "/"
153     */
154    SLASH(0x2F, "Slash"),
155
156    /**
157     * Constant for the {@code 0} key.
158     */
159    DIGIT0(0x30, "0", KeyCodeClass.DIGIT),
160
161    /**
162     * Constant for the {@code 1} key.
163     */
164    DIGIT1(0x31, "1", KeyCodeClass.DIGIT),
165
166    /**
167     * Constant for the {@code 2} key.
168     */
169    DIGIT2(0x32, "2", KeyCodeClass.DIGIT),
170
171    /**
172     * Constant for the {@code 3} key.
173     */
174    DIGIT3(0x33, "3", KeyCodeClass.DIGIT),
175
176    /**
177     * Constant for the {@code 4} key.
178     */
179    DIGIT4(0x34, "4", KeyCodeClass.DIGIT),
180
181    /**
182     * Constant for the {@code 5} key.
183     */
184    DIGIT5(0x35, "5", KeyCodeClass.DIGIT),
185
186    /**
187     * Constant for the {@code 6} key.
188     */
189    DIGIT6(0x36, "6", KeyCodeClass.DIGIT),
190
191    /**
192     * Constant for the {@code 7} key.
193     */
194    DIGIT7(0x37, "7", KeyCodeClass.DIGIT),
195
196    /**
197     * Constant for the {@code 8} key.
198     */
199    DIGIT8(0x38, "8", KeyCodeClass.DIGIT),
200
201    /**
202     * Constant for the {@code 9} key.
203     */
204    DIGIT9(0x39, "9", KeyCodeClass.DIGIT),
205
206    /**
207     * Constant for the semicolon key, ";"
208     */
209    SEMICOLON(0x3B, "Semicolon"),
210
211    /**
212     * Constant for the equals key, "="
213     */
214    EQUALS(0x3D, "Equals"),
215
216    /**
217     * Constant for the {@code A} key.
218     */
219    A(0x41, "A", KeyCodeClass.LETTER),
220
221    /**
222     * Constant for the {@code B} key.
223     */
224    B(0x42, "B", KeyCodeClass.LETTER),
225
226    /**
227     * Constant for the {@code C} key.
228     */
229    C(0x43, "C", KeyCodeClass.LETTER),
230
231    /**
232     * Constant for the {@code D} key.
233     */
234    D(0x44, "D", KeyCodeClass.LETTER),
235
236    /**
237     * Constant for the {@code E} key.
238     */
239    E(0x45, "E", KeyCodeClass.LETTER),
240
241    /**
242     * Constant for the {@code F} key.
243     */
244    F(0x46, "F", KeyCodeClass.LETTER),
245
246    /**
247     * Constant for the {@code G} key.
248     */
249    G(0x47, "G", KeyCodeClass.LETTER),
250
251    /**
252     * Constant for the {@code H} key.
253     */
254    H(0x48, "H", KeyCodeClass.LETTER),
255
256    /**
257     * Constant for the {@code I} key.
258     */
259    I(0x49, "I", KeyCodeClass.LETTER),
260
261    /**
262     * Constant for the {@code J} key.
263     */
264    J(0x4A, "J", KeyCodeClass.LETTER),
265
266    /**
267     * Constant for the {@code K} key.
268     */
269    K(0x4B, "K", KeyCodeClass.LETTER),
270
271    /**
272     * Constant for the {@code L} key.
273     */
274    L(0x4C, "L", KeyCodeClass.LETTER),
275
276    /**
277     * Constant for the {@code M} key.
278     */
279    M(0x4D, "M", KeyCodeClass.LETTER),
280
281    /**
282     * Constant for the {@code N} key.
283     */
284    N(0x4E, "N", KeyCodeClass.LETTER),
285
286    /**
287     * Constant for the {@code O} key.
288     */
289    O(0x4F, "O", KeyCodeClass.LETTER),
290
291    /**
292     * Constant for the {@code P} key.
293     */
294    P(0x50, "P", KeyCodeClass.LETTER),
295
296    /**
297     * Constant for the {@code Q} key.
298     */
299    Q(0x51, "Q", KeyCodeClass.LETTER),
300
301    /**
302     * Constant for the {@code R} key.
303     */
304    R(0x52, "R", KeyCodeClass.LETTER),
305
306    /**
307     * Constant for the {@code S} key.
308     */
309    S(0x53, "S", KeyCodeClass.LETTER),
310
311    /**
312     * Constant for the {@code T} key.
313     */
314    T(0x54, "T", KeyCodeClass.LETTER),
315
316    /**
317     * Constant for the {@code U} key.
318     */
319    U(0x55, "U", KeyCodeClass.LETTER),
320
321    /**
322     * Constant for the {@code V} key.
323     */
324    V(0x56, "V", KeyCodeClass.LETTER),
325
326    /**
327     * Constant for the {@code W} key.
328     */
329    W(0x57, "W", KeyCodeClass.LETTER),
330
331    /**
332     * Constant for the {@code X} key.
333     */
334    X(0x58, "X", KeyCodeClass.LETTER),
335
336    /**
337     * Constant for the {@code Y} key.
338     */
339    Y(0x59, "Y", KeyCodeClass.LETTER),
340
341    /**
342     * Constant for the {@code Z} key.
343     */
344    Z(0x5A, "Z", KeyCodeClass.LETTER),
345
346    /**
347     * Constant for the open bracket key, "["
348     */
349    OPEN_BRACKET(0x5B, "Open Bracket"),
350
351    /**
352     * Constant for the back slash key, "\"
353     */
354    BACK_SLASH(0x5C, "Back Slash"),
355
356    /**
357     * Constant for the close bracket key, "]"
358     */
359    CLOSE_BRACKET(0x5D, "Close Bracket"),
360
361    /**
362     * Constant for the {@code Numpad 0} key.
363     */
364    NUMPAD0(0x60, "Numpad 0", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
365
366    /**
367     * Constant for the {@code Numpad 1} key.
368     */
369    NUMPAD1(0x61, "Numpad 1", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
370
371    /**
372     * Constant for the {@code Numpad 2} key.
373     */
374    NUMPAD2(0x62, "Numpad 2", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
375
376    /**
377     * Constant for the {@code Numpad 3} key.
378     */
379    NUMPAD3(0x63, "Numpad 3", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
380
381    /**
382     * Constant for the {@code Numpad 4} key.
383     */
384    NUMPAD4(0x64, "Numpad 4", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
385
386    /**
387     * Constant for the {@code Numpad 5} key.
388     */
389    NUMPAD5(0x65, "Numpad 5", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
390
391    /**
392     * Constant for the {@code Numpad 6} key.
393     */
394    NUMPAD6(0x66, "Numpad 6", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
395
396    /**
397     * Constant for the {@code Numpad 7} key.
398     */
399    NUMPAD7(0x67, "Numpad 7", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
400
401    /**
402     * Constant for the {@code Numpad 8} key.
403     */
404    NUMPAD8(0x68, "Numpad 8", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
405
406    /**
407     * Constant for the {@code Numpad 9} key.
408     */
409    NUMPAD9(0x69, "Numpad 9", KeyCodeClass.DIGIT | KeyCodeClass.KEYPAD),
410
411    /**
412     * Constant for the {@code Multiply} key.
413     */
414    MULTIPLY(0x6A, "Multiply"),
415
416    /**
417     * Constant for the {@code Add} key.
418     */
419    ADD(0x6B, "Add"),
420
421    /**
422     * Constant for the Numpad Separator key.
423     */
424    SEPARATOR(0x6C, "Separator"),
425
426    /**
427     * Constant for the {@code Subtract} key.
428     */
429    SUBTRACT(0x6D, "Subtract"),
430
431    /**
432     * Constant for the {@code Decimal} key.
433     */
434    DECIMAL(0x6E, "Decimal"),
435
436    /**
437     * Constant for the {@code Divide} key.
438     */
439    DIVIDE(0x6F, "Divide"),
440
441    /**
442     * Constant for the {@code Delete} key.
443     */
444    DELETE(0x7F, "Delete"), /* ASCII:Integer   DEL */
445
446    /**
447     * Constant for the {@code Num Lock} key.
448     */
449    NUM_LOCK(0x90, "Num Lock"),
450
451    /**
452     * Constant for the {@code Scroll Lock} key.
453     */
454    SCROLL_LOCK(0x91, "Scroll Lock"),
455
456    /**
457     * Constant for the F1 function key.
458     */
459    F1(0x70, "F1", KeyCodeClass.FUNCTION),
460
461    /**
462     * Constant for the F2 function key.
463     */
464    F2(0x71, "F2", KeyCodeClass.FUNCTION),
465
466    /**
467     * Constant for the F3 function key.
468     */
469    F3(0x72, "F3", KeyCodeClass.FUNCTION),
470
471    /**
472     * Constant for the F4 function key.
473     */
474    F4(0x73, "F4", KeyCodeClass.FUNCTION),
475
476    /**
477     * Constant for the F5 function key.
478     */
479    F5(0x74, "F5", KeyCodeClass.FUNCTION),
480
481    /**
482     * Constant for the F6 function key.
483     */
484    F6(0x75, "F6", KeyCodeClass.FUNCTION),
485
486    /**
487     * Constant for the F7 function key.
488     */
489    F7(0x76, "F7", KeyCodeClass.FUNCTION),
490
491    /**
492     * Constant for the F8 function key.
493     */
494    F8(0x77, "F8", KeyCodeClass.FUNCTION),
495
496    /**
497     * Constant for the F9 function key.
498     */
499    F9(0x78, "F9", KeyCodeClass.FUNCTION),
500
501    /**
502     * Constant for the F10 function key.
503     */
504    F10(0x79, "F10", KeyCodeClass.FUNCTION),
505
506    /**
507     * Constant for the F11 function key.
508     */
509    F11(0x7A, "F11", KeyCodeClass.FUNCTION),
510
511    /**
512     * Constant for the F12 function key.
513     */
514    F12(0x7B, "F12", KeyCodeClass.FUNCTION),
515
516    /**
517     * Constant for the F13 function key.
518     */
519    F13(0xF000, "F13", KeyCodeClass.FUNCTION),
520
521    /**
522     * Constant for the F14 function key.
523     */
524    F14(0xF001, "F14", KeyCodeClass.FUNCTION),
525
526    /**
527     * Constant for the F15 function key.
528     */
529    F15(0xF002, "F15", KeyCodeClass.FUNCTION),
530
531    /**
532     * Constant for the F16 function key.
533     */
534    F16(0xF003, "F16", KeyCodeClass.FUNCTION),
535
536    /**
537     * Constant for the F17 function key.
538     */
539    F17(0xF004, "F17", KeyCodeClass.FUNCTION),
540
541    /**
542     * Constant for the F18 function key.
543     */
544    F18(0xF005, "F18", KeyCodeClass.FUNCTION),
545
546    /**
547     * Constant for the F19 function key.
548     */
549    F19(0xF006, "F19", KeyCodeClass.FUNCTION),
550
551    /**
552     * Constant for the F20 function key.
553     */
554    F20(0xF007, "F20", KeyCodeClass.FUNCTION),
555
556    /**
557     * Constant for the F21 function key.
558     */
559    F21(0xF008, "F21", KeyCodeClass.FUNCTION),
560
561    /**
562     * Constant for the F22 function key.
563     */
564    F22(0xF009, "F22", KeyCodeClass.FUNCTION),
565
566    /**
567     * Constant for the F23 function key.
568     */
569    F23(0xF00A, "F23", KeyCodeClass.FUNCTION),
570
571    /**
572     * Constant for the F24 function key.
573     */
574    F24(0xF00B, "F24", KeyCodeClass.FUNCTION),
575
576    /**
577     * Constant for the {@code Print Screen} key.
578     */
579    PRINTSCREEN(0x9A, "Print Screen"),
580
581    /**
582     * Constant for the {@code Insert} key.
583     */
584    INSERT(0x9B, "Insert"),
585
586    /**
587     * Constant for the {@code Help} key.
588     */
589    HELP(0x9C, "Help"),
590
591    /**
592     * Constant for the {@code Meta} key.
593     */
594    META(0x9D, "Meta", KeyCodeClass.MODIFIER),
595
596    /**
597     * Constant for the {@code Back Quote} key.
598     */
599    BACK_QUOTE(0xC0, "Back Quote"),
600
601    /**
602     * Constant for the {@code Quote} key.
603     */
604    QUOTE(0xDE, "Quote"),
605
606    /**
607     * Constant for the numeric keypad <b>up</b> arrow key.
608     */
609    KP_UP(0xE0, "Numpad Up", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION | KeyCodeClass.KEYPAD),
610
611    /**
612     * Constant for the numeric keypad <b>down</b> arrow key.
613     */
614    KP_DOWN(0xE1, "Numpad Down", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION | KeyCodeClass.KEYPAD),
615
616    /**
617     * Constant for the numeric keypad <b>left</b> arrow key.
618     */
619    KP_LEFT(0xE2, "Numpad Left", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION | KeyCodeClass.KEYPAD),
620
621    /**
622     * Constant for the numeric keypad <b>right</b> arrow key.
623     */
624    KP_RIGHT(0xE3, "Numpad Right", KeyCodeClass.ARROW | KeyCodeClass.NAVIGATION | KeyCodeClass.KEYPAD),
625
626    /**
627     * Constant for the {@code Dead Grave} key.
628     */
629    DEAD_GRAVE(0x80, "Dead Grave"),
630
631    /**
632     * Constant for the {@code Dead Acute} key.
633     */
634    DEAD_ACUTE(0x81, "Dead Acute"),
635
636    /**
637     * Constant for the {@code Circumflex} key.
638     */
639    DEAD_CIRCUMFLEX(0x82, "Circumflex"),
640
641    /**
642     * Constant for the {@code Dead Tilde} key.
643     */
644    DEAD_TILDE(0x83, "Dead Tilde"),
645
646    /**
647     * Constant for the {@code Dead Macron} key.
648     */
649    DEAD_MACRON(0x84, "Dead Macron"),
650
651    /**
652     * Constant for the {@code Dead Breve} key.
653     */
654    DEAD_BREVE(0x85, "Dead Breve"),
655
656    /**
657     * Constant for the {@code Dead Abovedot} key.
658     */
659    DEAD_ABOVEDOT(0x86, "Dead Abovedot"),
660
661    /**
662     * Constant for the {@code Dead Diaeresis} key.
663     */
664    DEAD_DIAERESIS(0x87, "Dead Diaeresis"),
665
666    /**
667     * Constant for the {@code Dead Abovering} key.
668     */
669    DEAD_ABOVERING(0x88, "Dead Abovering"),
670
671    /**
672     * Constant for the {@code Dead Doubleacute} key.
673     */
674    DEAD_DOUBLEACUTE(0x89, "Dead Doubleacute"),
675
676    /**
677     * Constant for the {@code Dead Caron} key.
678     */
679    DEAD_CARON(0x8a, "Dead Caron"),
680
681    /**
682     * Constant for the {@code Dead Cedilla} key.
683     */
684    DEAD_CEDILLA(0x8b, "Dead Cedilla"),
685
686    /**
687     * Constant for the {@code Dead Ogonek} key.
688     */
689    DEAD_OGONEK(0x8c, "Dead Ogonek"),
690
691    /**
692     * Constant for the {@code Dead Iota} key.
693     */
694    DEAD_IOTA(0x8d, "Dead Iota"),
695
696    /**
697     * Constant for the {@code Dead Voiced Sound} key.
698     */
699    DEAD_VOICED_SOUND(0x8e, "Dead Voiced Sound"),
700
701    /**
702     * Constant for the {@code Dead Semivoiced Sound} key.
703     */
704    DEAD_SEMIVOICED_SOUND(0x8f, "Dead Semivoiced Sound"),
705
706    /**
707     * Constant for the {@code Ampersand} key.
708     */
709    AMPERSAND(0x96, "Ampersand"),
710
711    /**
712     * Constant for the {@code Asterisk} key.
713     */
714    ASTERISK(0x97, "Asterisk"),
715
716    /**
717     * Constant for the {@code Double Quote} key.
718     */
719    QUOTEDBL(0x98, "Double Quote"),
720
721    /**
722     * Constant for the {@code Less} key.
723     */
724    LESS(0x99, "Less"),
725
726    /**
727     * Constant for the {@code Greater} key.
728     */
729    GREATER(0xa0, "Greater"),
730
731    /**
732     * Constant for the {@code Left Brace} key.
733     */
734    BRACELEFT(0xa1, "Left Brace"),
735
736    /**
737     * Constant for the {@code Right Brace} key.
738     */
739    BRACERIGHT(0xa2, "Right Brace"),
740
741    /**
742     * Constant for the "@" key.
743     */
744    AT(0x0200, "At"),
745
746    /**
747     * Constant for the ":" key.
748     */
749    COLON(0x0201, "Colon"),
750
751    /**
752     * Constant for the "^" key.
753     */
754    CIRCUMFLEX(0x0202, "Circumflex"),
755
756    /**
757     * Constant for the "$" key.
758     */
759    DOLLAR(0x0203, "Dollar"),
760
761    /**
762     * Constant for the Euro currency sign key.
763     */
764    EURO_SIGN(0x0204, "Euro Sign"),
765
766    /**
767     * Constant for the "!" key.
768     */
769    EXCLAMATION_MARK(0x0205, "Exclamation Mark"),
770
771    /**
772     * Constant for the inverted exclamation mark key.
773     */
774    INVERTED_EXCLAMATION_MARK(0x0206, "Inverted Exclamation Mark"),
775
776    /**
777     * Constant for the "(" key.
778     */
779    LEFT_PARENTHESIS(0x0207, "Left Parenthesis"),
780
781    /**
782     * Constant for the "#" key.
783     */
784    NUMBER_SIGN(0x0208, "Number Sign"),
785
786    /**
787     * Constant for the "+" key.
788     */
789    PLUS(0x0209, "Plus"),
790
791    /**
792     * Constant for the ")" key.
793     */
794    RIGHT_PARENTHESIS(0x020A, "Right Parenthesis"),
795
796    /**
797     * Constant for the "_" key.
798     */
799    UNDERSCORE(0x020B, "Underscore"),
800
801    /**
802     * Constant for the Microsoft Windows "Windows" key.
803     * It is used for both the left and right version of the key.
804     */
805    WINDOWS(0x020C, "Windows", KeyCodeClass.MODIFIER),
806
807    /**
808     * Constant for the Microsoft Windows Context Menu key.
809     */
810    CONTEXT_MENU(0x020D, "Context Menu"),
811
812    /**
813     * Constant for input method support on Asian Keyboards.
814     */
815    FINAL(0x0018, "Final"),
816
817    /**
818     * Constant for the Convert function key.
819     */
820    CONVERT(0x001C, "Convert"),
821
822    /**
823     * Constant for the Don't Convert function key.
824     */
825    NONCONVERT(0x001D, "Nonconvert"),
826
827    /**
828     * Constant for the Accept or Commit function key.
829     */
830    ACCEPT(0x001E, "Accept"),
831
832    /**
833     * Constant for the {@code Mode Change} key.
834     */
835    MODECHANGE(0x001F, "Mode Change"),
836    /**
837     * Constant for the {@code Kana} key.
838     */
839    KANA(0x0015, "Kana"),
840    /**
841     * Constant for the {@code Kanji} key.
842     */
843    KANJI(0x0019, "Kanji"),
844
845    /**
846     * Constant for the Alphanumeric function key.
847     */
848    ALPHANUMERIC(0x00F0, "Alphanumeric"),
849
850    /**
851     * Constant for the Katakana function key.
852     */
853    KATAKANA(0x00F1, "Katakana"),
854
855    /**
856     * Constant for the Hiragana function key.
857     */
858    HIRAGANA(0x00F2, "Hiragana"),
859
860    /**
861     * Constant for the Full-Width Characters function key.
862     */
863    FULL_WIDTH(0x00F3, "Full Width"),
864
865    /**
866     * Constant for the Half-Width Characters function key.
867     */
868    HALF_WIDTH(0x00F4, "Half Width"),
869
870    /**
871     * Constant for the Roman Characters function key.
872     */
873    ROMAN_CHARACTERS(0x00F5, "Roman Characters"),
874
875    /**
876     * Constant for the All Candidates function key.
877     */
878    ALL_CANDIDATES(0x0100, "All Candidates"),
879
880    /**
881     * Constant for the Previous Candidate function key.
882     */
883    PREVIOUS_CANDIDATE(0x0101, "Previous Candidate"),
884
885    /**
886     * Constant for the Code Input function key.
887     */
888    CODE_INPUT(0x0102, "Code Input"),
889
890    /**
891     * Constant for the Japanese-Katakana function key.
892     * This key switches to a Japanese input method and selects its Katakana input mode.
893     */
894    JAPANESE_KATAKANA(0x0103, "Japanese Katakana"),
895
896    /**
897     * Constant for the Japanese-Hiragana function key.
898     * This key switches to a Japanese input method and selects its Hiragana input mode.
899     */
900    JAPANESE_HIRAGANA(0x0104, "Japanese Hiragana"),
901
902    /**
903     * Constant for the Japanese-Roman function key.
904     * This key switches to a Japanese input method and selects its Roman-Direct input mode.
905     */
906    JAPANESE_ROMAN(0x0105, "Japanese Roman"),
907
908    /**
909     * Constant for the locking Kana function key.
910     * This key locks the keyboard into a Kana layout.
911     */
912    KANA_LOCK(0x0106, "Kana Lock"),
913
914    /**
915     * Constant for the input method on/off key.
916     */
917    INPUT_METHOD_ON_OFF(0x0107, "Input Method On/Off"),
918
919    /**
920     * Constant for the {@code Cut} key.
921     */
922    CUT(0xFFD1, "Cut"),
923
924    /**
925     * Constant for the {@code Copy} key.
926     */
927    COPY(0xFFCD, "Copy"),
928
929    /**
930     * Constant for the {@code Paste} key.
931     */
932    PASTE(0xFFCF, "Paste"),
933
934    /**
935     * Constant for the {@code Undo} key.
936     */
937    UNDO(0xFFCB, "Undo"),
938
939    /**
940     * Constant for the {@code Again} key.
941     */
942    AGAIN(0xFFC9, "Again"),
943
944    /**
945     * Constant for the {@code Find} key.
946     */
947    FIND(0xFFD0, "Find"),
948
949    /**
950     * Constant for the {@code Properties} key.
951     */
952    PROPS(0xFFCA, "Properties"),
953
954    /**
955     * Constant for the {@code Stop} key.
956     */
957    STOP(0xFFC8, "Stop"),
958
959    /**
960     * Constant for the input method on/off key.
961     */
962    COMPOSE(0xFF20, "Compose"),
963
964    /**
965     * Constant for the AltGraph function key.
966     */
967    ALT_GRAPH(0xFF7E, "Alt Graph", KeyCodeClass.MODIFIER),
968
969    /**
970     * Constant for the Begin key.
971     */
972    BEGIN(0xFF58, "Begin"),
973
974    /**
975     * This value is used to indicate that the keyCode is unknown.
976     * Key typed events do not have a keyCode value; this value
977     * is used instead.
978     */
979    UNDEFINED(0x0, "Undefined"),
980
981
982    //--------------------------------------------------------------
983    //
984    // Mobile and Embedded Specific Key Codes
985    //
986    //--------------------------------------------------------------
987
988    /**
989     * Constant for the {@code Softkey 0} key.
990     */
991    SOFTKEY_0(0x1000, "Softkey 0"),
992
993    /**
994     * Constant for the {@code Softkey 1} key.
995     */
996    SOFTKEY_1(0x1001, "Softkey 1"),
997
998    /**
999     * Constant for the {@code Softkey 2} key.
1000     */
1001    SOFTKEY_2(0x1002, "Softkey 2"),
1002
1003    /**
1004     * Constant for the {@code Softkey 3} key.
1005     */
1006    SOFTKEY_3(0x1003, "Softkey 3"),
1007
1008    /**
1009     * Constant for the {@code Softkey 4} key.
1010     */
1011    SOFTKEY_4(0x1004, "Softkey 4"),
1012
1013    /**
1014     * Constant for the {@code Softkey 5} key.
1015     */
1016    SOFTKEY_5(0x1005, "Softkey 5"),
1017
1018    /**
1019     * Constant for the {@code Softkey 6} key.
1020     */
1021    SOFTKEY_6(0x1006, "Softkey 6"),
1022
1023    /**
1024     * Constant for the {@code Softkey 7} key.
1025     */
1026    SOFTKEY_7(0x1007, "Softkey 7"),
1027
1028    /**
1029     * Constant for the {@code Softkey 8} key.
1030     */
1031    SOFTKEY_8(0x1008, "Softkey 8"),
1032
1033    /**
1034     * Constant for the {@code Softkey 9} key.
1035     */
1036    SOFTKEY_9(0x1009, "Softkey 9"),
1037
1038    /**
1039     * Constant for the {@code Game A} key.
1040     */
1041    GAME_A(0x100A, "Game A"),
1042
1043    /**
1044     * Constant for the {@code Game B} key.
1045     */
1046    GAME_B(0x100B, "Game B"),
1047
1048    /**
1049     * Constant for the {@code Game C} key.
1050     */
1051    GAME_C(0x100C, "Game C"),
1052
1053    /**
1054     * Constant for the {@code Game D} key.
1055     */
1056    GAME_D(0x100D, "Game D"),
1057
1058    /**
1059     * Constant for the {@code Star} key.
1060     */
1061    STAR(0x100E, "Star"),
1062
1063    /**
1064     * Constant for the {@code Pound} key.
1065     */
1066    POUND(0x100F, "Pound"),
1067
1068    /**
1069     * Set of TV Specific Key Codes
1070     *
1071     * @since JavaFX 1.3
1072     */
1073
1074    /**
1075     * Constant for the {@code Power} key.
1076     */
1077    POWER(0x199, "Power"),
1078
1079    /**
1080     * Constant for the {@code Info} key.
1081     */
1082    INFO(0x1C9, "Info"),
1083
1084    /**
1085     * Constant for the {@code Colored Key 0} key.
1086     */
1087    COLORED_KEY_0(0x193, "Colored Key 0"),
1088
1089    /**
1090     * Constant for the {@code Colored Key 1} key.
1091     */
1092    COLORED_KEY_1(0x194, "Colored Key 1"),
1093
1094    /**
1095     * Constant for the {@code Colored Key 2} key.
1096     */
1097    COLORED_KEY_2(0x195, "Colored Key 2"),
1098
1099    /**
1100     * Constant for the {@code Colored Key 3} key.
1101     */
1102    COLORED_KEY_3(0x196, "Colored Key 3"),
1103
1104    /**
1105     * Constant for the {@code Eject} key.
1106     */
1107    EJECT_TOGGLE(0x19E, "Eject", KeyCodeClass.MEDIA),
1108
1109    /**
1110     * Constant for the {@code Play} key.
1111     */
1112    PLAY(0x19F, "Play", KeyCodeClass.MEDIA),
1113
1114    /**
1115     * Constant for the {@code Record} key.
1116     */
1117    RECORD(0x1A0, "Record", KeyCodeClass.MEDIA),
1118
1119    /**
1120     * Constant for the {@code Fast Forward} key.
1121     */
1122    FAST_FWD(0x1A1, "Fast Forward", KeyCodeClass.MEDIA),
1123
1124    /**
1125     * Constant for the {@code Rewind} key.
1126     */
1127    REWIND(0x19C, "Rewind", KeyCodeClass.MEDIA),
1128
1129    /**
1130     * Constant for the {@code Previous Track} key.
1131     */
1132    TRACK_PREV(0x1A8, "Previous Track", KeyCodeClass.MEDIA),
1133
1134    /**
1135     * Constant for the {@code Next Track} key.
1136     */
1137    TRACK_NEXT(0x1A9, "Next Track", KeyCodeClass.MEDIA),
1138
1139    /**
1140     * Constant for the {@code Channel Up} key.
1141     */
1142    CHANNEL_UP(0x1AB, "Channel Up", KeyCodeClass.MEDIA),
1143
1144    /**
1145     * Constant for the {@code Channel Down} key.
1146     */
1147    CHANNEL_DOWN(0x1AC, "Channel Down", KeyCodeClass.MEDIA),
1148
1149    /**
1150     * Constant for the {@code Volume Up} key.
1151     */
1152    VOLUME_UP(0x1bf, "Volume Up", KeyCodeClass.MEDIA),
1153
1154    /**
1155     * Constant for the {@code Volume Down} key.
1156     */
1157    VOLUME_DOWN(0x1C0, "Volume Down", KeyCodeClass.MEDIA),
1158
1159    /**
1160     * Constant for the {@code Mute} key.
1161     */
1162    MUTE(0x1C1, "Mute", KeyCodeClass.MEDIA),
1163
1164    /**
1165     * Constant for the Apple {@code Command} key. 
1166     */
1167    COMMAND(0x300, "Command", KeyCodeClass.MODIFIER),
1168    
1169    /**
1170     * Constant for the {@code Shortcut} key.
1171     */
1172    SHORTCUT(-1, "Shortcut");
1173
1174    final int code;
1175    final String ch;
1176    final String name;
1177    private int mask;
1178
1179    // Need to bundle this in another class to avoid "forward reference" compiler error
1180    private static class KeyCodeClass {
1181        private KeyCodeClass() {};
1182
1183        private static final int FUNCTION = 1;
1184        private static final int NAVIGATION = 1 << 1;
1185        private static final int ARROW = 1 << 2;
1186        private static final int MODIFIER = 1 << 3;
1187        private static final int LETTER = 1 << 4;
1188        private static final int DIGIT = 1 << 5;
1189        private static final int KEYPAD = 1 << 6;
1190        private static final int WHITESPACE = 1 << 7;
1191        private static final int MEDIA = 1 << 8;
1192    }
1193
1194    private KeyCode(int code, String name, int mask) {
1195        this.code = code;
1196        this.name = name;
1197        this.mask = mask;
1198        // ch = new String(Character.toChars(code));
1199        ch = String.valueOf((char)code);
1200    }
1201
1202    private KeyCode(int code, String name) {
1203        this(code, name, 0);
1204    }
1205
1206    /**
1207     * Function keys like F1, F2, etc...
1208     * @return true if this key code corresponds to a functional key
1209     * @since 2.2
1210     */
1211    public final boolean isFunctionKey() {
1212        return (mask & KeyCodeClass.FUNCTION) != 0;
1213    }
1214
1215    /**
1216     * Navigation keys are arrow keys and Page Down, Page Up, Home, End
1217     * (including keypad keys)
1218     * @return true if this key code corresponds to a navigation key
1219     * @since 2.2
1220     */
1221    public final boolean isNavigationKey() {
1222        return (mask & KeyCodeClass.NAVIGATION) != 0;
1223    }
1224
1225    /**
1226     * Left, right, up, down keys (including the keypad arrows)
1227     * @return true if this key code corresponds to an arrow key
1228     * @since 2.2
1229     */
1230    public final boolean isArrowKey() {
1231        return (mask & KeyCodeClass.ARROW) != 0;
1232    }
1233
1234    /**
1235     * Keys that could act as a modifier
1236     * @return true if this key code corresponds to a modifier key
1237     * @since 2.2
1238     */
1239    public final boolean isModifierKey() {
1240        return (mask & KeyCodeClass.MODIFIER) != 0;
1241    }
1242
1243    /**
1244     * All keys with letters
1245     * @return true if this key code corresponds to a letter key
1246     * @since 2.2
1247     */
1248    public final boolean isLetterKey() {
1249        return (mask & KeyCodeClass.LETTER) != 0;
1250    }
1251
1252    /**
1253     * All Digit keys (including the keypad digits)
1254     * @return true if this key code corresponds to a digit key
1255     * @since 2.2
1256     */
1257    public final boolean isDigitKey() {
1258        return (mask & KeyCodeClass.DIGIT) != 0;
1259    }
1260
1261    /**
1262     * All keys on the keypad
1263     * @return true if this key code corresponds to a keypad key
1264     * @since 2.2
1265     */
1266    public final boolean isKeypadKey() {
1267        return (mask & KeyCodeClass.KEYPAD) != 0;
1268    }
1269
1270    /**
1271     * Space, tab and enter
1272     * @return true if this key code corresponds to a whitespace key
1273     * @since 2.2
1274     */
1275    public final boolean isWhitespaceKey() {
1276        return (mask & KeyCodeClass.WHITESPACE) != 0;
1277    }
1278
1279    /**
1280     * All multimedia keys (channel up/down, volume control, etc...)
1281     * @return true if this key code corresponds to a media key
1282     * @since 2.2
1283     */
1284    public final boolean isMediaKey() {
1285        return (mask & KeyCodeClass.MEDIA) != 0;
1286    }
1287
1288    /**
1289     * Gets name of this key code.
1290     * @return Name of this key code
1291     */
1292    public final String getName() {
1293        return name;
1294    }
1295
1296    /**
1297     * @treatAsPrivate implementation detail
1298     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
1299     */
1300    @Deprecated
1301    public String impl_getChar() {
1302        return ch;
1303    }
1304
1305    /**
1306     * @treatAsPrivate implementation detail
1307     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
1308     */
1309    // SB-dependency: RT-22749 has been filed to track this
1310    @Deprecated
1311    public int impl_getCode() {
1312        return code;
1313    }
1314
1315   
1316    private static final Map<String, KeyCode> nameMap;
1317    static {
1318        
1319        nameMap = new HashMap<String, KeyCode>(KeyCode.values().length);
1320        for (KeyCode c : KeyCode.values()) {
1321            nameMap.put(c.name, c);
1322        }
1323    }
1324
1325    /**
1326     * Parses textual representation of a key.
1327     * @param name Textual representation of the key
1328     * @return KeyCode for the key with the given name, null if the string
1329     *                 is unknown.
1330     */
1331    public static KeyCode getKeyCode(String name) {
1332        return nameMap.get(name);
1333    }
1334
1335}