| org.w3c.dom.events.KeyboardEvent
All known Subclasses: org.apache.batik.dom.events.DOMKeyboardEvent,
KeyboardEvent | public interface KeyboardEvent extends UIEvent(Code) | | The KeyboardEvent interface provides specific contextual
information associated with keyboard devices. Each keyboard event
references a key using an identifier. Keyboard events are commonly
directed at the element that has the focus.
The KeyboardEvent interface provides convenient attributes
for some common modifiers keys: KeyboardEvent.ctrlKey ,
KeyboardEvent.shiftKey , KeyboardEvent.altKey ,
KeyboardEvent.metaKey . These attributes are equivalent to
use the method
KeyboardEvent.getModifierState(keyIdentifierArg) with
"Control", "Shift", "Alt", or "Meta" respectively.
To create an instance of the KeyboardEvent interface, use
the DocumentEvent.createEvent("KeyboardEvent") method call.
See also the
Document Object Model (DOM) Level 3 Events Specification
.
since: DOM Level 3 |
Field Summary | |
final public static int | DOM_KEY_LOCATION_LEFT The key activated is in the left key location (there is more than one
possible location for this key). | final public static int | DOM_KEY_LOCATION_NUMPAD The key activation originated on the numeric keypad or with a virtual
key corresponding to the numeric keypad. | final public static int | DOM_KEY_LOCATION_RIGHT The key activation is in the right key location (there is more than
one possible location for this key). | final public static int | DOM_KEY_LOCATION_STANDARD The key activation is not distinguished as the left or right version
of the key, and did not originate from the numeric keypad (or did not
originate with a virtual key corresponding to the numeric keypad). |
Method Summary | |
public boolean | getAltKey() true if the alternative (Alt) key modifier is activated. | public boolean | getCtrlKey() true if the control (Ctrl) key modifier is activated. | public String | getKeyIdentifier() keyIdentifier holds the identifier of the key. | public int | getKeyLocation() The keyLocation attribute contains an indication of the
location of they key on the device, as described in . | public boolean | getMetaKey() true if the meta (Meta) key modifier is activated. | public boolean | getModifierState(String keyIdentifierArg) This methods queries the state of a modifier using a key identifier. | public boolean | getShiftKey() true if the shift (Shift) key modifier is activated. | public void | initKeyboardEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, String keyIdentifierArg, int keyLocationArg, String modifiersList) The initKeyboardEvent method is used to initialize the
value of a KeyboardEvent object and has the same
behavior as UIEvent.initUIEvent() . | public void | initKeyboardEventNS(String namespaceURI, String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, String keyIdentifierArg, int keyLocationArg, String modifiersList) The initKeyboardEventNS method is used to initialize the
value of a KeyboardEvent object and has the same
behavior as UIEvent.initUIEventNS() . |
DOM_KEY_LOCATION_LEFT | final public static int DOM_KEY_LOCATION_LEFT(Code) | | The key activated is in the left key location (there is more than one
possible location for this key). Example: the left Shift key on a PC
101 Key US keyboard.
|
DOM_KEY_LOCATION_NUMPAD | final public static int DOM_KEY_LOCATION_NUMPAD(Code) | | The key activation originated on the numeric keypad or with a virtual
key corresponding to the numeric keypad. Example: the '1' key on a PC
101 Key US keyboard located on the numeric pad.
|
DOM_KEY_LOCATION_RIGHT | final public static int DOM_KEY_LOCATION_RIGHT(Code) | | The key activation is in the right key location (there is more than
one possible location for this key). Example: the right Shift key on
a PC 101 Key US keyboard.
|
DOM_KEY_LOCATION_STANDARD | final public static int DOM_KEY_LOCATION_STANDARD(Code) | | The key activation is not distinguished as the left or right version
of the key, and did not originate from the numeric keypad (or did not
originate with a virtual key corresponding to the numeric keypad).
Example: the 'Q' key on a PC 101 Key US keyboard.
|
getAltKey | public boolean getAltKey()(Code) | | true if the alternative (Alt) key modifier is activated.
Note: The Option key modifier on Macintosh systems must be
represented using this key modifier.
|
getCtrlKey | public boolean getCtrlKey()(Code) | | true if the control (Ctrl) key modifier is activated.
|
getKeyIdentifier | public String getKeyIdentifier()(Code) | | keyIdentifier holds the identifier of the key. The key
identifiers are defined in Appendix A.2 "". Implementations that are
unable to identify a key must use the key identifier
"Unidentified" .
|
getKeyLocation | public int getKeyLocation()(Code) | | The keyLocation attribute contains an indication of the
location of they key on the device, as described in .
|
getMetaKey | public boolean getMetaKey()(Code) | | true if the meta (Meta) key modifier is activated.
Note: The Command key modifier on Macintosh systems must be
represented using this key modifier.
|
getModifierState | public boolean getModifierState(String keyIdentifierArg)(Code) | | This methods queries the state of a modifier using a key identifier.
See also .
Parameters: keyIdentifierArg - A modifier key identifier. Common modifier keys are "Alt" , "AltGraph" , "CapsLock" , "Control" , "Meta" , "NumLock" , "Scroll" , or "Shift" . Note: If an application wishes to distinguish between right and left modifiers, this information could be deduced using keyboard events and KeyboardEvent.keyLocation . true if it is modifier key and the modifier is activated, false otherwise. |
getShiftKey | public boolean getShiftKey()(Code) | | true if the shift (Shift) key modifier is activated.
|
initKeyboardEvent | public void initKeyboardEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, String keyIdentifierArg, int keyLocationArg, String modifiersList)(Code) | | The initKeyboardEvent method is used to initialize the
value of a KeyboardEvent object and has the same
behavior as UIEvent.initUIEvent() . The value of
UIEvent.detail remains undefined.
Parameters: typeArg - Refer to the UIEvent.initUIEvent() method for a description of this parameter. Parameters: canBubbleArg - Refer to the UIEvent.initUIEvent() method for a description of this parameter. Parameters: cancelableArg - Refer to the UIEvent.initUIEvent() method for a description of this parameter. Parameters: viewArg - Refer to the UIEvent.initUIEvent() method for a description of this parameter. Parameters: keyIdentifierArg - Specifies KeyboardEvent.keyIdentifier . Parameters: keyLocationArg - Specifies KeyboardEvent.keyLocation . Parameters: modifiersList - A white space separated list of modifier key identifiers to be activated on this object. |
initKeyboardEventNS | public void initKeyboardEventNS(String namespaceURI, String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, String keyIdentifierArg, int keyLocationArg, String modifiersList)(Code) | | The initKeyboardEventNS method is used to initialize the
value of a KeyboardEvent object and has the same
behavior as UIEvent.initUIEventNS() . The value of
UIEvent.detail remains undefined.
Parameters: namespaceURI - Refer to the UIEvent.initUIEventNS() method for a description of this parameter. Parameters: typeArg - Refer to the UIEvent.initUIEventNS() method for a description of this parameter. Parameters: canBubbleArg - Refer to the UIEvent.initUIEventNS() method for a description of this parameter. Parameters: cancelableArg - Refer to the UIEvent.initUIEventNS() method for a description of this parameter. Parameters: viewArg - Refer to the UIEvent.initUIEventNS() method for a description of this parameter. Parameters: keyIdentifierArg - Refer to the KeyboardEvent.initKeyboardEvent() method for a description of this parameter. Parameters: keyLocationArg - Refer to the KeyboardEvent.initKeyboardEvent() method for a description of this parameter. Parameters: modifiersList - A white space separated list of modifier key identifiers to be activated on this object. As an example, "Control Alt" will activated the control and alt modifiers. |
|
|