org.safs.natives
Class MSKeyEvent

java.lang.Object
  extended by org.safs.natives.MSKeyEvent

public class MSKeyEvent
extends java.lang.Object

This class contains Microsoft Virtual Key Code, refer to following link
http://msdn.microsoft.com/en-us/library/dd375731(v=VS.85).aspx
It contains some convenient method to test MS virtual key code, such as isShiftKey(int) isAltKey(int)
There is another method convertToJavaVK(int), which can convert
MS virtual key code to Java virtual key code.

See Also:
MSLLKtoRKEventListener

Field Summary
static int VK_APPS
           
static int VK_BACK
           
static int VK_CANCEL
           
static int VK_CAPITAL
           
static int VK_CLEAR
           
static int VK_CONTROL
           
static int VK_DELETE
           
static int VK_DOWN
           
static int VK_END
           
static int VK_ESCAPE
           
static int VK_EXECUTE
           
static int VK_HELP
           
static int VK_HOME
           
static int VK_INSERT
           
static int VK_LCONTROL
           
static int VK_LEFT
           
static int VK_LMENU
           
static int VK_LSHIFT
           
static int VK_LWIN
           
static int VK_MENU
           
static int VK_NEXT
           
static int VK_OEM_1
           
static int VK_OEM_2
           
static int VK_OEM_3
           
static int VK_OEM_4
           
static int VK_OEM_5
           
static int VK_OEM_6
           
static int VK_OEM_7
           
static int VK_OEM_8
           
static int VK_OEM_COMMA
           
static int VK_OEM_MINUS
           
static int VK_OEM_PERIOD
           
static int VK_OEM_PLUS
           
static int VK_PAUSE
           
static int VK_PRINT
           
static int VK_PRIOR
           
static int VK_RCONTROL
           
static int VK_RETURN
           
static int VK_RIGHT
           
static int VK_RMENU
           
static int VK_RSHIFT
           
static int VK_RWIN
           
static int VK_SELECT
           
static int VK_SHIFT
           
static int VK_SNAPSHOT
           
static int VK_SPACE
           
static int VK_TAB
           
static int VK_UP
           
 
Constructor Summary
MSKeyEvent()
           
 
Method Summary
static int convertToJavaVK(int MSVkcode)
          Purpose: The windows virtual key code is NOT consistent with that of JAVA
This function is used to convert the different key code of windows to that of JAVA.
Note: For those key codes of the same value between Windows and Java, they are not converted here.
This function may be need to updated, if one day they are not the same.

For those key codes has two java key codes to map (one is with Shift On, one without), we
convert to the Java key code without Shift On.
For example:
Windows key code: VK_OEM_4, it represents the key '[{' of US keyboard
Java has one key code VK_OPEN_BRACKET for '[' (without shift on),
and one key code VK_BRACELEFT for '{' (with shift on)
We will return VK_OPEN_BRACKET as result, the one without shift on
static boolean isAltKey(int vkcode)
           
static boolean isCapsLockKey(int vkcode)
           
static boolean isControlKey(int vkcode)
           
static boolean isEnter(int vkcode)
           
static boolean isShiftKey(int vkcode)
           
static boolean isWindowsKey(int vkcode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VK_LSHIFT

public static final int VK_LSHIFT
See Also:
Constant Field Values

VK_RSHIFT

public static final int VK_RSHIFT
See Also:
Constant Field Values

VK_LCONTROL

public static final int VK_LCONTROL
See Also:
Constant Field Values

VK_RCONTROL

public static final int VK_RCONTROL
See Also:
Constant Field Values

VK_LMENU

public static final int VK_LMENU
See Also:
Constant Field Values

VK_RMENU

public static final int VK_RMENU
See Also:
Constant Field Values

VK_RETURN

public static final int VK_RETURN
See Also:
Constant Field Values

VK_CANCEL

public static final int VK_CANCEL
See Also:
Constant Field Values

VK_BACK

public static final int VK_BACK
See Also:
Constant Field Values

VK_TAB

public static final int VK_TAB
See Also:
Constant Field Values

VK_CLEAR

public static final int VK_CLEAR
See Also:
Constant Field Values

VK_SHIFT

public static final int VK_SHIFT
See Also:
Constant Field Values

VK_CONTROL

public static final int VK_CONTROL
See Also:
Constant Field Values

VK_MENU

public static final int VK_MENU
See Also:
Constant Field Values

VK_PAUSE

public static final int VK_PAUSE
See Also:
Constant Field Values

VK_CAPITAL

public static final int VK_CAPITAL
See Also:
Constant Field Values

VK_ESCAPE

public static final int VK_ESCAPE
See Also:
Constant Field Values

VK_SPACE

public static final int VK_SPACE
See Also:
Constant Field Values

VK_PRIOR

public static final int VK_PRIOR
See Also:
Constant Field Values

VK_NEXT

public static final int VK_NEXT
See Also:
Constant Field Values

VK_END

public static final int VK_END
See Also:
Constant Field Values

VK_HOME

public static final int VK_HOME
See Also:
Constant Field Values

VK_LEFT

public static final int VK_LEFT
See Also:
Constant Field Values

VK_UP

public static final int VK_UP
See Also:
Constant Field Values

VK_RIGHT

public static final int VK_RIGHT
See Also:
Constant Field Values

VK_DOWN

public static final int VK_DOWN
See Also:
Constant Field Values

VK_SELECT

public static final int VK_SELECT
See Also:
Constant Field Values

VK_PRINT

public static final int VK_PRINT
See Also:
Constant Field Values

VK_EXECUTE

public static final int VK_EXECUTE
See Also:
Constant Field Values

VK_SNAPSHOT

public static final int VK_SNAPSHOT
See Also:
Constant Field Values

VK_INSERT

public static final int VK_INSERT
See Also:
Constant Field Values

VK_DELETE

public static final int VK_DELETE
See Also:
Constant Field Values

VK_HELP

public static final int VK_HELP
See Also:
Constant Field Values

VK_LWIN

public static final int VK_LWIN
See Also:
Constant Field Values

VK_RWIN

public static final int VK_RWIN
See Also:
Constant Field Values

VK_APPS

public static final int VK_APPS
See Also:
Constant Field Values

VK_OEM_1

public static final int VK_OEM_1
See Also:
Constant Field Values

VK_OEM_PLUS

public static final int VK_OEM_PLUS
See Also:
Constant Field Values

VK_OEM_COMMA

public static final int VK_OEM_COMMA
See Also:
Constant Field Values

VK_OEM_MINUS

public static final int VK_OEM_MINUS
See Also:
Constant Field Values

VK_OEM_PERIOD

public static final int VK_OEM_PERIOD
See Also:
Constant Field Values

VK_OEM_2

public static final int VK_OEM_2
See Also:
Constant Field Values

VK_OEM_3

public static final int VK_OEM_3
See Also:
Constant Field Values

VK_OEM_4

public static final int VK_OEM_4
See Also:
Constant Field Values

VK_OEM_5

public static final int VK_OEM_5
See Also:
Constant Field Values

VK_OEM_6

public static final int VK_OEM_6
See Also:
Constant Field Values

VK_OEM_7

public static final int VK_OEM_7
See Also:
Constant Field Values

VK_OEM_8

public static final int VK_OEM_8
See Also:
Constant Field Values
Constructor Detail

MSKeyEvent

public MSKeyEvent()
Method Detail

isShiftKey

public static boolean isShiftKey(int vkcode)

isControlKey

public static boolean isControlKey(int vkcode)

isAltKey

public static boolean isAltKey(int vkcode)

isWindowsKey

public static boolean isWindowsKey(int vkcode)

isCapsLockKey

public static boolean isCapsLockKey(int vkcode)

isEnter

public static boolean isEnter(int vkcode)

convertToJavaVK

public static int convertToJavaVK(int MSVkcode)
Purpose: The windows virtual key code is NOT consistent with that of JAVA
This function is used to convert the different key code of windows to that of JAVA.
Note: For those key codes of the same value between Windows and Java, they are not converted here.
This function may be need to updated, if one day they are not the same.

For those key codes has two java key codes to map (one is with Shift On, one without), we
convert to the Java key code without Shift On.
For example:
Windows key code: VK_OEM_4, it represents the key '[{' of US keyboard
Java has one key code VK_OPEN_BRACKET for '[' (without shift on),
and one key code VK_BRACELEFT for '{' (with shift on)
We will return VK_OPEN_BRACKET as result, the one without shift on

Parameters:
MSVkcode - The Virtual Key Code for Windows, see
http://msdn.microsoft.com/en-us/library/dd375731(v=VS.85).aspx
Returns:
The corresponding JAVA VK KEY CODE