|
1 | 1 | package org.openpatch.scratch; |
2 | 2 |
|
3 | 3 | /** |
4 | | - * Contains virtual key code constants for keyboard input handling. These constants represent |
| 4 | + * Contains virtual key code constants for keyboard input handling. These |
| 5 | + * constants represent |
5 | 6 | * various keys on a keyboard including: |
6 | 7 | * |
7 | 8 | * <ul> |
8 | | - * <li>Standard character keys (letters, numbers, symbols) |
9 | | - * <li>Function keys (F1-F24) |
10 | | - * <li>Navigation keys (arrows, home, end, etc.) |
11 | | - * <li>Modifier keys (shift, ctrl, alt, etc.) |
12 | | - * <li>Numpad keys |
13 | | - * <li>Special keys for international keyboards |
14 | | - * <li>Media and system control keys |
| 9 | + * <li>Standard character keys (letters, numbers, symbols) |
| 10 | + * <li>Function keys (F1-F24) |
| 11 | + * <li>Navigation keys (arrows, home, end, etc.) |
| 12 | + * <li>Modifier keys (shift, ctrl, alt, etc.) |
| 13 | + * <li>Numpad keys |
| 14 | + * <li>Special keys for international keyboards |
| 15 | + * <li>Media and system control keys |
15 | 16 | * </ul> |
16 | 17 | * |
17 | | - * The key codes are defined as integer constants and follow common virtual key code standards used |
18 | | - * in various platforms. Many of these codes align with ASCII values for basic characters, while |
| 18 | + * The key codes are defined as integer constants and follow common virtual key |
| 19 | + * code standards used |
| 20 | + * in various platforms. Many of these codes align with ASCII values for basic |
| 21 | + * characters, while |
19 | 22 | * others use platform-specific ranges for special keys. |
20 | 23 | * |
21 | | - * <p>This class includes support for: |
| 24 | + * <p> |
| 25 | + * This class includes support for: |
22 | 26 | * |
23 | 27 | * <ul> |
24 | | - * <li>Standard US QWERTY keyboard layout |
25 | | - * <li>European keyboard specific keys |
26 | | - * <li>Asian keyboard specific keys (Japanese, Korean, etc.) |
27 | | - * <li>Sun keyboard specific functions |
28 | | - * <li>Microsoft Windows specific keys |
| 28 | + * <li>Standard US QWERTY keyboard layout |
| 29 | + * <li>European keyboard specific keys |
| 30 | + * <li>Asian keyboard specific keys (Japanese, Korean, etc.) |
| 31 | + * <li>Sun keyboard specific functions |
| 32 | + * <li>Microsoft Windows specific keys |
29 | 33 | * </ul> |
30 | 34 | * |
31 | | - * <p>The constants in this class are intended to be used for keyboard event handling and key |
| 35 | + * <p> |
| 36 | + * The constants in this class are intended to be used for keyboard event |
| 37 | + * handling and key |
32 | 38 | * mapping operations. |
33 | 39 | * |
| 40 | + * Use can use these constants to identify which key was pressed or released in |
| 41 | + * keyboard events. |
| 42 | + * |
| 43 | + * For example: |
| 44 | + * |
| 45 | + * <pre>{@code |
| 46 | + * public void whenKeyPressed(int keyCode) { |
| 47 | + * if (keyCode == KeyCode.VK_ENTER) { |
| 48 | + * // Handle enter key press |
| 49 | + * } |
| 50 | + * }</pre> |
| 51 | + * |
| 52 | + * <pre> |
| 53 | + * {@code |
| 54 | + * if (this.isKeyPressed(KeyCode.VK_SPACE)) { |
| 55 | + * // Handle space key being pressed |
| 56 | + * } |
| 57 | + * } |
| 58 | + * </pre> |
| 59 | + * |
34 | 60 | */ |
35 | 61 | public final class KeyCode { |
36 | 62 | /* Virtual key codes. */ |
@@ -494,7 +520,8 @@ public final class KeyCode { |
494 | 520 | public static final int VK_UNDERSCORE = 0x020B; |
495 | 521 |
|
496 | 522 | /** |
497 | | - * Constant for the Microsoft Windows "Windows" key. It is used for both the left and right |
| 523 | + * Constant for the Microsoft Windows "Windows" key. It is used for both the |
| 524 | + * left and right |
498 | 525 | * version of the key. |
499 | 526 | */ |
500 | 527 | public static final int VK_WINDOWS = 0x020C; |
@@ -522,12 +549,16 @@ public final class KeyCode { |
522 | 549 | /* not clear what this means - listed in Microsoft Windows API */ |
523 | 550 | public static final int VK_MODECHANGE = 0x001F; |
524 | 551 |
|
525 | | - /* replaced by VK_KANA_LOCK for Microsoft Windows and Solaris; |
526 | | - might still be used on other platforms */ |
| 552 | + /* |
| 553 | + * replaced by VK_KANA_LOCK for Microsoft Windows and Solaris; |
| 554 | + * might still be used on other platforms |
| 555 | + */ |
527 | 556 | public static final int VK_KANA = 0x0015; |
528 | 557 |
|
529 | | - /* replaced by VK_INPUT_METHOD_ON_OFF for Microsoft Windows and Solaris; |
530 | | - might still be used for other platforms */ |
| 558 | + /* |
| 559 | + * replaced by VK_INPUT_METHOD_ON_OFF for Microsoft Windows and Solaris; |
| 560 | + * might still be used for other platforms |
| 561 | + */ |
531 | 562 | public static final int VK_KANJI = 0x0019; |
532 | 563 |
|
533 | 564 | /** Constant for the Alphanumeric function key. */ |
@@ -567,28 +598,37 @@ public final class KeyCode { |
567 | 598 | public static final int VK_CODE_INPUT = 0x0102; |
568 | 599 |
|
569 | 600 | /** |
570 | | - * Constant for the Japanese-Katakana function key. This key switches to a Japanese input method |
| 601 | + * Constant for the Japanese-Katakana function key. This key switches to a |
| 602 | + * Japanese input method |
571 | 603 | * and selects its Katakana input mode. |
572 | 604 | */ |
573 | 605 | /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */ |
574 | 606 | public static final int VK_JAPANESE_KATAKANA = 0x0103; |
575 | 607 |
|
576 | 608 | /** |
577 | | - * Constant for the Japanese-Hiragana function key. This key switches to a Japanese input method |
| 609 | + * Constant for the Japanese-Hiragana function key. This key switches to a |
| 610 | + * Japanese input method |
578 | 611 | * and selects its Hiragana input mode. |
579 | 612 | */ |
580 | 613 | /* Japanese Macintosh keyboard */ |
581 | 614 | public static final int VK_JAPANESE_HIRAGANA = 0x0104; |
582 | 615 |
|
583 | 616 | /** |
584 | | - * Constant for the Japanese-Roman function key. This key switches to a Japanese input method and |
| 617 | + * Constant for the Japanese-Roman function key. This key switches to a Japanese |
| 618 | + * input method and |
585 | 619 | * selects its Roman-Direct input mode. |
586 | 620 | */ |
587 | 621 | /* Japanese Macintosh keyboard */ |
588 | 622 | public static final int VK_JAPANESE_ROMAN = 0x0105; |
589 | 623 |
|
590 | | - /** Constant for the locking Kana function key. This key locks the keyboard into a Kana layout. */ |
591 | | - /* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */ |
| 624 | + /** |
| 625 | + * Constant for the locking Kana function key. This key locks the keyboard into |
| 626 | + * a Kana layout. |
| 627 | + */ |
| 628 | + /* |
| 629 | + * Japanese PC 106 keyboard with special Windows driver - eisuu + Control; |
| 630 | + * Japanese Solaris keyboard: kana |
| 631 | + */ |
592 | 632 | public static final int VK_KANA_LOCK = 0x0106; |
593 | 633 |
|
594 | 634 | /** Constant for the input method on/off key. */ |
|
0 commit comments