Class WKeyEvent
- All Implemented Interfaces:
WAbstractEvent
A key event is associated with the WInteractWidget.keyWentDown()
, WInteractWidget.keyWentUp()
and WInteractWidget.keyPressed()
signals.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateFromJSEvent
(eu.webtoolkit.jwt.JavaScriptEvent jsEvent) Internal method.int
Returns the unicode character code.getKey()
Returns the key code key that was pressed or released.Returns keyboard modifiers.getText()
The (unicode) text that this key generated.
-
Constructor Details
-
WKeyEvent
public WKeyEvent()Default constructor.
-
-
Method Details
-
getKey
Returns the key code key that was pressed or released.The key code corresponds to the actual key on the keyboard, rather than the generated character.
All three types of key events provide this information.
- See Also:
-
getModifiers
Returns keyboard modifiers.The result is a logical OR of
KeyboardModifier
flags.All three types of key events provide this information.
- See Also:
-
getCharCode
public int getCharCode()Returns the unicode character code.This is only defined for a
WInteractWidget.keyPressed()
event, and returns the unicode character code point of a character that is entered.For the
WInteractWidget.keyWentDown()
andWInteractWidget.keyWentUp()
events, '0' is returned.The
getCharCode()
may be different fromgetKey()
. For example, aKey.M
key may correspond to 'm' or 'M' character, depending on whether the shift key is pressed simultaneously. -
getText
The (unicode) text that this key generated.This is only defined for a
WInteractWidget.keyPressed()
event, and returns a string that holds exactly one unicode character, which corresponds togetCharCode()
.For the
WInteractWidget.keyWentDown()
andWInteractWidget.keyWentUp()
events, an empty string is returned.- See Also:
-
createFromJSEvent
Description copied from interface:WAbstractEvent
Internal method.- Specified by:
createFromJSEvent
in interfaceWAbstractEvent
-