java.lang.Object
org.bzdev.swing.keys.VirtualKeys
Class to look up key events by name.
The class
KeyEvent
defines a large number of
static int constants with names that begin with the string "VK_".
This class provides a single method that allows these constants
to be looked up at runtime by name.
One use of this class is for localization, where one might want to include key names in a properties file associated with a resource bundle.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
VirtualKeys
public VirtualKeys()
-
-
Method Details
-
lookup
Look up a virtual key code by name.- Parameters:
name
- the name of a constant starting with the string "VK_" defined by the classKeyEvent
- Returns:
- the constant defined by a static field of
KeyEvent
with the same name - Throws:
IllegalArgumentException
-