Class WKeyEvent
- java.lang.Object
-
- eu.webtoolkit.jwt.WKeyEvent
-
- All Implemented Interfaces:
WAbstractEvent
public class WKeyEvent extends java.lang.Object implements WAbstractEvent
A class providing details for a keyboard event.A key event is associated with the
WInteractWidget.keyWentDown(),WInteractWidget.keyWentUp()andWInteractWidget.keyPressed()signals.
-
-
Constructor Summary
Constructors Constructor Description WKeyEvent()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WAbstractEventcreateFromJSEvent(eu.webtoolkit.jwt.JavaScriptEvent jsEvent)Internal method.intgetCharCode()Returns the unicode character code.KeygetKey()Returns the key code key that was pressed or released.java.util.EnumSet<KeyboardModifier>getModifiers()Returns keyboard modifiers.java.lang.StringgetText()The (unicode) text that this key generated.
-
-
-
Method Detail
-
getKey
public Key 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(),getCharCode()
-
getModifiers
public java.util.EnumSet<KeyboardModifier> getModifiers()
Returns keyboard modifiers.The result is a logical OR of
KeyboardModifierflags.All three types of key events provide this information.
- See Also:
getKey(),getCharCode()
-
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.Mkey may correspond to 'm' or 'M' character, depending on whether the shift key is pressed simultaneously.
-
getText
public java.lang.String 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:
getCharCode()
-
createFromJSEvent
public WAbstractEvent createFromJSEvent(eu.webtoolkit.jwt.JavaScriptEvent jsEvent)
Description copied from interface:WAbstractEventInternal method.- Specified by:
createFromJSEventin interfaceWAbstractEvent
-
-