Skip to content

Commit d5525ae

Browse files
committed
update docs
1 parent 7f2cfa0 commit d5525ae

File tree

1 file changed

+67
-27
lines changed

1 file changed

+67
-27
lines changed

src/main/java/org/openpatch/scratch/KeyCode.java

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,62 @@
11
package org.openpatch.scratch;
22

33
/**
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
56
* various keys on a keyboard including:
67
*
78
* <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
1516
* </ul>
1617
*
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
1922
* others use platform-specific ranges for special keys.
2023
*
21-
* <p>This class includes support for:
24+
* <p>
25+
* This class includes support for:
2226
*
2327
* <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
2933
* </ul>
3034
*
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
3238
* mapping operations.
3339
*
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+
*
3460
*/
3561
public final class KeyCode {
3662
/* Virtual key codes. */
@@ -494,7 +520,8 @@ public final class KeyCode {
494520
public static final int VK_UNDERSCORE = 0x020B;
495521

496522
/**
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
498525
* version of the key.
499526
*/
500527
public static final int VK_WINDOWS = 0x020C;
@@ -522,12 +549,16 @@ public final class KeyCode {
522549
/* not clear what this means - listed in Microsoft Windows API */
523550
public static final int VK_MODECHANGE = 0x001F;
524551

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+
*/
527556
public static final int VK_KANA = 0x0015;
528557

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+
*/
531562
public static final int VK_KANJI = 0x0019;
532563

533564
/** Constant for the Alphanumeric function key. */
@@ -567,28 +598,37 @@ public final class KeyCode {
567598
public static final int VK_CODE_INPUT = 0x0102;
568599

569600
/**
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
571603
* and selects its Katakana input mode.
572604
*/
573605
/* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
574606
public static final int VK_JAPANESE_KATAKANA = 0x0103;
575607

576608
/**
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
578611
* and selects its Hiragana input mode.
579612
*/
580613
/* Japanese Macintosh keyboard */
581614
public static final int VK_JAPANESE_HIRAGANA = 0x0104;
582615

583616
/**
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
585619
* selects its Roman-Direct input mode.
586620
*/
587621
/* Japanese Macintosh keyboard */
588622
public static final int VK_JAPANESE_ROMAN = 0x0105;
589623

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+
*/
592632
public static final int VK_KANA_LOCK = 0x0106;
593633

594634
/** Constant for the input method on/off key. */

0 commit comments

Comments
 (0)