-
Bug
-
Resolution: Fixed
-
P4
-
1.1.3, 1.2.0
-
1.2fcs
-
x86
-
windows_95, windows_nt
-
Not verified
Name: joT67522 Date: 11/05/97
I'm trying to map key codes to key characters. VK_BACKSLASH is defined as 5Ch, or 92 decimal.
Yet when I trap key events and display the key code, it prints 220 decimal. There are other
punctuation characters that don't work, such as slash, comma, open and closed brackets, and
a few others. I had to hard code their decimal values because the VK constants did not have
the correct values.
To populate my hash table for key lookups, I had to use:
keyTable.put( ".", new Integer( 190 ) );
keyTable.put( "/", new Integer( 191 ) );
keyTable.put( ";", new Integer( 186 ) );
keyTable.put( "=", new Integer( 187 ) );
keyTable.put( "\\", new Integer( 220 ) );
keyTable.put( "[", new Integer( 219 ) );
keyTable.put( "]", new Integer( 221 ) );
keyTable.put( ",", new Integer( 188 ) );
For others, I used:
keyTable.put( "F1",
new Integer( KeyEvent.VK_F1 ) );
keyTable.put( "F2",
new Integer( KeyEvent.VK_F2 ) );
keyTable.put( "F3",
new Integer( KeyEvent.VK_F3 ) );
keyTable.put( "F4",
new Integer( KeyEvent.VK_F4 ) );
keyTable.put( "F5",
new Integer( KeyEvent.VK_F5 ) );
Why am I doing all of this? We have to may Retail POS keyboards to 101 key
mappings. Some keys on the keyboard send out alpha chars, others send out
numpad chars, and other send out special chars like F1. Our application allows
the user to remap the keys for different application functions. That is what the
hash table is for.
(Review ID: 19747)
======================================================================
- duplicates
-
JDK-4065459 KeyCode for / inn KeyPressed Event is incorrect
-
- Closed
-
-
JDK-4138870 VK_SLASH=47 while KeyEvent.getKeyCode()=191 when Ctrl-/ is pressed
-
- Closed
-
- relates to
-
JDK-4151419 getKeyCode(), getKeyChar() returns incorrect value at KEY_PRESSED event.
-
- Closed
-