com.aspose.html.dom.events

Class KeyboardEvent



  • @DOMObjectAttribute
     @DOMNameAttribute(name="KeyboardEvent")
    public class KeyboardEvent
    extends UIEvent

    The KeyboardEvent interface provides specific contextual information associated with keyboard devices. Each keyboard event references a key using a value. Keyboard events are commonly directed at the element that has the focus.

    • Field Detail

      • DOM_KEY_LOCATION_STANDARD

        public static final long DOM_KEY_LOCATION_STANDARD

        The key activation MUST NOT be distinguished as the left or right version of the key, and (other than the NumLock key) did not originate from the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad).

        See Also:
        Constant Field Values
      • DOM_KEY_LOCATION_LEFT

        public static final long DOM_KEY_LOCATION_LEFT

        The key activated originated from the left key location (when there is more than one possible location for this key).

        See Also:
        Constant Field Values
      • DOM_KEY_LOCATION_RIGHT

        public static final long DOM_KEY_LOCATION_RIGHT

        The key activation originated from the right key location (when there is more than one possible location for this key).

        See Also:
        Constant Field Values
      • DOM_KEY_LOCATION_NUMPAD

        public static final long DOM_KEY_LOCATION_NUMPAD

        The key activation originated on the numeric keypad or with a virtual key corresponding to the numeric keypad (when there is more than one possible location for this key). Note that the NumLock key should always be encoded with a location of DOM_KEY_LOCATION_STANDARD.

        See Also:
        Constant Field Values
    • Constructor Detail

      • KeyboardEvent

        public KeyboardEvent(String type)

        Initializes a new instance of the KeyboardEvent class.

        Parameters:
        type - The event type.
    • Method Detail

      • getKey

        @DOMNameAttribute(name="key")
        public String getKey()

        The key holds the key value of the key pressed. If the value is has a printed representation, it MUST be a non-empty Unicode character string, conforming to the algorithm for determining the key value defined in this specification. If the value is a control key which has no printed representation, it MUST be one of the key values defined in the key values set, as determined by the algorithm for determining the key value. Implementations that are unable to identify a key MUST use the key value Unidentified.

        Value: The key value.
      • getCode

        @DOMNameAttribute(name="code")
        public String getCode()

        The code holds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.

        Value: The key code.
      • getLocation

        @DOMNameAttribute(name="location")
        public long getLocation()

        The location attribute contains an indication of the logical location of the key on the device.

        Value: The location.
      • getCtrlKey

        @DOMNameAttribute(name="ctrlKey")
        public boolean getCtrlKey()

        true if the Control (control) key modifier was active. The un-initialized value of this attribute MUST be false.

        Value: true if Control; otherwise, false.
      • getShiftKey

        @DOMNameAttribute(name="shiftKey")
        public boolean getShiftKey()

        true if the shift (Shift) key modifier was active.

        Value: true if Shift; otherwise, false.
      • getAltKey

        @DOMNameAttribute(name="altKey")
        public boolean getAltKey()

        true if the Alt (alternative) (or "Option") key modifier was active. The un-initialized value of this attribute MUST be false.

        Value: true if Alt; otherwise, false.
      • getMetaKey

        @DOMNameAttribute(name="metaKey")
        public boolean getMetaKey()

        true if the meta (Meta) key modifier was active.

        Value: true if Meta; otherwise, false.
      • getRepeat

        @DOMNameAttribute(name="repeat")
        public boolean getRepeat()

        true if the key has been pressed in a sustained manner. Holding down a key MUST result in the repeating the events keydown, beforeinput, input in this order, at a rate determined by the system configuration. For mobile devices which have long-key-press behavior, the first key event with a repeat attribute value of true MUST serve as an indication of a long-key-press. The length of time that the key MUST be pressed in order to begin repeating is configuration-dependent.

        Value: true if repeat; otherwise, false.
      • isComposing

        @DOMNameAttribute(name="isComposing")
        public boolean isComposing()

        true if the key event occurs as part of a composition session, i.e., after a compositionstart event and before the corresponding compositionend event. The un-initialized value of this attribute MUST be false.

        Value: true if this instance is composing; otherwise, false.