ibm.techexplorer.awt.event
Class KeyEvent

java.lang.Object
  |
  +--ibm.techexplorer.util.EventObject
        |
        +--ibm.techexplorer.awt.AWTEvent
              |
              +--ibm.techexplorer.awt.event.InputEvent
                    |
                    +--ibm.techexplorer.awt.event.KeyEvent

public class KeyEvent
extends InputEvent

Description

The KeyEvent indicates that a key has been pressed, released or typed in a techexplorer instance window. Like the Java 1.1 AWT, techexplorer provides three types of KeyEvents, namely KEY_PRESSED, KEY_RELEASED and KEY_TYPED. Keys on the keyboard are assigned a unique key code. KeyEvent defines a set of common key codes. Note that some keyboards may not be able to fire all of the key codes or may have keys that do not correspond to a key code. In the latter case, the key code VK_UNDEFINED is used to represent undefined key codes. Hence, key events generated by KEY_PRESSED and KEY_RELEASED may not correspond to Unicode characters. To check for this situation, always use the getKeyCode method to obtain the virtual key code when responding to KEY_PRESSED and KEY_RELEASED events. KeyTyped events are generated when the pressed key contains a character value. In this case, use the getKetChar method to obtain the value.

In order for a Java object to receive key event notifications, the Java object must register a class that implements the ibm.techexplorer.awt.event.KeyListener interface. Alternatively, a key listener could make use of a ibm.techexplorer.awt.event.KeyAdaptor class.

Current Restriction: Note that although the techexplorer AWT event model allows a Java applet to handle key events, the generation or modification of techexplorer key events from Java is not permitted in this version.

See Also:
AWTEvent, KeyListener, KeyAdaptor

Field Summary
static char CHAR_UNDEFINED
          KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character are without a defined keyChar.
static int KEY_PRESSED
          Event identifier indicating the keyboard was pressed.
static int KEY_RELEASED
          Event identifier indicating the keyboard was released.
static int KEY_TYPED
          Event identifier indicating that a combination of a key press followed by a key release generated a character.
static int VK_0
          VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)
static int VK_1
           
static int VK_2
           
static int VK_3
           
static int VK_4
           
static int VK_5
           
static int VK_6
           
static int VK_7
           
static int VK_8
           
static int VK_9
           
static int VK_A
          VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)
static int VK_ADD
           
static int VK_ALT
           
static int VK_B
           
static int VK_BACK_QUOTE
           
static int VK_BACK_SLASH
           
static int VK_BACK_SPACE
           
static int VK_C
           
static int VK_CANCEL
           
static int VK_CAPS_LOCK
           
static int VK_CLEAR
           
static int VK_CLOSE_BRACKET
           
static int VK_COMMA
           
static int VK_CONTROL
           
static int VK_D
           
static int VK_DECIMAL
           
static int VK_DELETE
           
static int VK_DIVIDE
           
static int VK_DOWN
           
static int VK_E
           
static int VK_END
           
static int VK_ENTER
          Virtual key codes.
static int VK_EQUALS
           
static int VK_ESCAPE
           
static int VK_F
           
static int VK_F1
           
static int VK_F10
           
static int VK_F11
           
static int VK_F12
           
static int VK_F2
           
static int VK_F3
           
static int VK_F4
           
static int VK_F5
           
static int VK_F6
           
static int VK_F7
           
static int VK_F8
           
static int VK_F9
           
static int VK_FINAL
           
static int VK_G
           
static int VK_H
           
static int VK_HELP
           
static int VK_HOME
           
static int VK_I
           
static int VK_INSERT
           
static int VK_J
           
static int VK_K
           
static int VK_L
           
static int VK_LEFT
           
static int VK_M
           
static int VK_META
           
static int VK_MULTIPLY
           
static int VK_N
           
static int VK_NUM_LOCK
           
static int VK_NUMPAD0
           
static int VK_NUMPAD1
           
static int VK_NUMPAD2
           
static int VK_NUMPAD3
           
static int VK_NUMPAD4
           
static int VK_NUMPAD5
           
static int VK_NUMPAD6
           
static int VK_NUMPAD7
           
static int VK_NUMPAD8
           
static int VK_NUMPAD9
           
static int VK_O
           
static int VK_OPEN_BRACKET
           
static int VK_P
           
static int VK_PAGE_DOWN
           
static int VK_PAGE_UP
           
static int VK_PAUSE
           
static int VK_PERIOD
           
static int VK_PRINTSCREEN
           
static int VK_Q
           
static int VK_QUOTE
           
static int VK_R
           
static int VK_RIGHT
           
static int VK_S
           
static int VK_SCROLL_LOCK
           
static int VK_SEMICOLON
           
static int VK_SEPARATER
           
static int VK_SHIFT
           
static int VK_SLASH
           
static int VK_SPACE
           
static int VK_SUBTRACT
           
static int VK_T
           
static int VK_TAB
           
static int VK_U
           
static int VK_UNDEFINED
          KEY_TYPED events do not have a defined keyCode.
static int VK_UP
           
static int VK_V
           
static int VK_W
           
static int VK_X
           
static int VK_Y
           
static int VK_Z
           
 
Fields inherited from class ibm.techexplorer.awt.event.InputEvent
ALT_MASK, BUTTON1_MASK, BUTTON2_MASK, BUTTON3_MASK, CTRL_MASK, META_MASK, modifiers, SHIFT_MASK
 
Fields inherited from class ibm.techexplorer.awt.AWTEvent
FOCUS_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK
 
Fields inherited from class ibm.techexplorer.util.EventObject
documentName, id, listenerClass, objectName, source
 
Constructor Summary
KeyEvent(java.lang.Object source, java.lang.String documentName, java.lang.String listenerClass, java.lang.String objectName, int id, int modifiers, int keyCode, char keyChar)
          Constructs a KeyEvent object with the specified techexplorer source instance, document source identifier, listener class, document object name, event type, modifiers, key code and character code.
 
Method Summary
 char getKeyChar()
          Retrieve the character associated with the key in this event.
 int getKeyCode()
          Retrieve the integer key code associated with the key in this event.
 
Methods inherited from class ibm.techexplorer.awt.event.InputEvent
getModifiers, isAltDown, isControlDown, isShiftDown
 
Methods inherited from class ibm.techexplorer.util.EventObject
getDocumentName, getID, getListenerClass, getObjectName, getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_TYPED

public static final int KEY_TYPED
Event identifier indicating that a combination of a key press followed by a key release generated a character.

KEY_PRESSED

public static final int KEY_PRESSED
Event identifier indicating the keyboard was pressed.

KEY_RELEASED

public static final int KEY_RELEASED
Event identifier indicating the keyboard was released.

VK_ENTER

public static final int VK_ENTER
Virtual key codes.

VK_BACK_SPACE

public static final int VK_BACK_SPACE

VK_TAB

public static final int VK_TAB

VK_CANCEL

public static final int VK_CANCEL

VK_CLEAR

public static final int VK_CLEAR

VK_SHIFT

public static final int VK_SHIFT

VK_CONTROL

public static final int VK_CONTROL

VK_ALT

public static final int VK_ALT

VK_PAUSE

public static final int VK_PAUSE

VK_CAPS_LOCK

public static final int VK_CAPS_LOCK

VK_ESCAPE

public static final int VK_ESCAPE

VK_SPACE

public static final int VK_SPACE

VK_PAGE_UP

public static final int VK_PAGE_UP

VK_PAGE_DOWN

public static final int VK_PAGE_DOWN

VK_END

public static final int VK_END

VK_HOME

public static final int VK_HOME

VK_LEFT

public static final int VK_LEFT

VK_UP

public static final int VK_UP

VK_RIGHT

public static final int VK_RIGHT

VK_DOWN

public static final int VK_DOWN

VK_COMMA

public static final int VK_COMMA

VK_PERIOD

public static final int VK_PERIOD

VK_SLASH

public static final int VK_SLASH

VK_0

public static final int VK_0
VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)

VK_1

public static final int VK_1

VK_2

public static final int VK_2

VK_3

public static final int VK_3

VK_4

public static final int VK_4

VK_5

public static final int VK_5

VK_6

public static final int VK_6

VK_7

public static final int VK_7

VK_8

public static final int VK_8

VK_9

public static final int VK_9

VK_SEMICOLON

public static final int VK_SEMICOLON

VK_EQUALS

public static final int VK_EQUALS

VK_A

public static final int VK_A
VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)

VK_B

public static final int VK_B

VK_C

public static final int VK_C

VK_D

public static final int VK_D

VK_E

public static final int VK_E

VK_F

public static final int VK_F

VK_G

public static final int VK_G

VK_H

public static final int VK_H

VK_I

public static final int VK_I

VK_J

public static final int VK_J

VK_K

public static final int VK_K

VK_L

public static final int VK_L

VK_M

public static final int VK_M

VK_N

public static final int VK_N

VK_O

public static final int VK_O

VK_P

public static final int VK_P

VK_Q

public static final int VK_Q

VK_R

public static final int VK_R

VK_S

public static final int VK_S

VK_T

public static final int VK_T

VK_U

public static final int VK_U

VK_V

public static final int VK_V

VK_W

public static final int VK_W

VK_X

public static final int VK_X

VK_Y

public static final int VK_Y

VK_Z

public static final int VK_Z

VK_OPEN_BRACKET

public static final int VK_OPEN_BRACKET

VK_BACK_SLASH

public static final int VK_BACK_SLASH

VK_CLOSE_BRACKET

public static final int VK_CLOSE_BRACKET

VK_NUMPAD0

public static final int VK_NUMPAD0

VK_NUMPAD1

public static final int VK_NUMPAD1

VK_NUMPAD2

public static final int VK_NUMPAD2

VK_NUMPAD3

public static final int VK_NUMPAD3

VK_NUMPAD4

public static final int VK_NUMPAD4

VK_NUMPAD5

public static final int VK_NUMPAD5

VK_NUMPAD6

public static final int VK_NUMPAD6

VK_NUMPAD7

public static final int VK_NUMPAD7

VK_NUMPAD8

public static final int VK_NUMPAD8

VK_NUMPAD9

public static final int VK_NUMPAD9

VK_MULTIPLY

public static final int VK_MULTIPLY

VK_ADD

public static final int VK_ADD

VK_SEPARATER

public static final int VK_SEPARATER

VK_SUBTRACT

public static final int VK_SUBTRACT

VK_DECIMAL

public static final int VK_DECIMAL

VK_DIVIDE

public static final int VK_DIVIDE

VK_F1

public static final int VK_F1

VK_F2

public static final int VK_F2

VK_F3

public static final int VK_F3

VK_F4

public static final int VK_F4

VK_F5

public static final int VK_F5

VK_F6

public static final int VK_F6

VK_F7

public static final int VK_F7

VK_F8

public static final int VK_F8

VK_F9

public static final int VK_F9

VK_F10

public static final int VK_F10

VK_F11

public static final int VK_F11

VK_F12

public static final int VK_F12

VK_DELETE

public static final int VK_DELETE

VK_NUM_LOCK

public static final int VK_NUM_LOCK

VK_SCROLL_LOCK

public static final int VK_SCROLL_LOCK

VK_PRINTSCREEN

public static final int VK_PRINTSCREEN

VK_INSERT

public static final int VK_INSERT

VK_HELP

public static final int VK_HELP

VK_META

public static final int VK_META

VK_BACK_QUOTE

public static final int VK_BACK_QUOTE

VK_QUOTE

public static final int VK_QUOTE

VK_FINAL

public static final int VK_FINAL

VK_UNDEFINED

public static final int VK_UNDEFINED
KEY_TYPED events do not have a defined keyCode.

CHAR_UNDEFINED

public static final char CHAR_UNDEFINED
KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character are without a defined keyChar.
Constructor Detail

KeyEvent

public KeyEvent(java.lang.Object source,
                java.lang.String documentName,
                java.lang.String listenerClass,
                java.lang.String objectName,
                int id,
                int modifiers,
                int keyCode,
                char keyChar)
Constructs a KeyEvent object with the specified techexplorer source instance, document source identifier, listener class, document object name, event type, modifiers, key code and character code.
Parameters:
source - The object where the event originated.
documentName - The name of the document that triggered the event.
listenerClass - The category of listeners that will receive notification of this event.
objectName - The name of the document object that triggered the event.
id - Event identifier (KEY_PRESSED, KEY_RELEASED and KEY_TYPED)
keyCode - The integer key code associated with the key.
keyChar - The character associated with the key.
Method Detail

getKeyChar

public char getKeyChar()
Retrieve the character associated with the key in this event.
Returns:
The character associated with the key.

getKeyCode

public int getKeyCode()
Retrieve the integer key code associated with the key in this event.
Returns:
The integer key code associated with the key.