public class

NativeEvent

extends JavaScriptObject
java.lang.Object
   ↳ com.google.gwt.core.client.JavaScriptObject
     ↳ com.google.gwt.dom.client.NativeEvent
Known Direct Subclasses

Class Overview

The native dom event.

Summary

Constants
int BUTTON_LEFT The left mouse button.
int BUTTON_MIDDLE The middle mouse button.
int BUTTON_RIGHT The right mouse button.
Protected Constructors
NativeEvent()
Required constructor for GWT compiler to function.
Public Methods
final boolean getAltKey()
Gets whether the ALT key was depressed when the given event occurred.
final int getButton()
Gets the mouse buttons that were depressed when the given event occurred.
final JsArray<Touch> getChangedTouches()
Get an array of touches which have changed since the last touch event.
final int getCharCode()
Gets the Unicode codepoint of the character generated by this key event.
final int getClientX()
Gets the mouse x-position within the browser window's client area.
final int getClientY()
Gets the mouse y-position within the browser window's client area.
final boolean getCtrlKey()
Gets whether the CTRL key was depressed when the given event occurred.
final EventTarget getCurrentEventTarget()
Gets the current target element of this event.
final EventTarget getEventTarget()
Returns the element that was the actual target of the given event.
final int getKeyCode()
Gets the key code (code associated with the physical key) associated with this event.
final boolean getMetaKey()
Gets whether the META key was depressed when the given event occurred.
final int getMouseWheelVelocityY()
Gets the velocity of the mouse wheel associated with the event along the Y axis.
final EventTarget getRelatedEventTarget()
Gets the related target for this event.
final double getRotation()
Get the rotation in degrees, with positive values indicating clockwise rotation.
final double getScale()
Get the amount scaled since the gesture started, with 1.0 representing no scaling.
final int getScreenX()
Gets the mouse x-position on the user's display.
final int getScreenY()
Gets the mouse y-position on the user's display.
final boolean getShiftKey()
Gets whether the shift key was depressed when the given event occurred.
final String getString()
Gets a string representation of this event.
final JsArray<Touch> getTargetTouches()
Get an array of touches which have changed since the last touch event.
final JsArray<Touch> getTouches()
Get an array of touches which have changed since the last touch event.
final String getType()
Gets the enumerated type of this event.
final void preventDefault()
Prevents the browser from taking its default action for the given event.
final void stopPropagation()
Stops the event from being propagated to parent elements.
[Expand]
Inherited Methods
From class com.google.gwt.core.client.JavaScriptObject
From class java.lang.Object

Constants

public static final int BUTTON_LEFT

The left mouse button.

Constant Value: 1 (0x00000001)

public static final int BUTTON_MIDDLE

The middle mouse button.

Constant Value: 4 (0x00000004)

public static final int BUTTON_RIGHT

The right mouse button.

Constant Value: 2 (0x00000002)

Protected Constructors

protected NativeEvent ()

Required constructor for GWT compiler to function.

Public Methods

public final boolean getAltKey ()

Gets whether the ALT key was depressed when the given event occurred.

Returns
  • true if ALT was depressed when the event occurred

public final int getButton ()

Gets the mouse buttons that were depressed when the given event occurred.

Returns

public final JsArray<Touch> getChangedTouches ()

Get an array of touches which have changed since the last touch event.

Returns
  • array of touches which have changed since the last touch event

public final int getCharCode ()

Gets the Unicode codepoint of the character generated by this key event.

Returns
  • the Unicode codepoint.

public final int getClientX ()

Gets the mouse x-position within the browser window's client area.

Returns
  • the mouse x-position

public final int getClientY ()

Gets the mouse y-position within the browser window's client area.

Returns
  • the mouse y-position

public final boolean getCtrlKey ()

Gets whether the CTRL key was depressed when the given event occurred.

Returns
  • true if CTRL was depressed when the event occurred

public final EventTarget getCurrentEventTarget ()

Gets the current target element of this event. This is the element whose listener fired last, not the element which fired the event initially.

Returns
  • the event's current target element

public final EventTarget getEventTarget ()

Returns the element that was the actual target of the given event.

Returns
  • the target element

public final int getKeyCode ()

Gets the key code (code associated with the physical key) associated with this event.

Returns
  • the key code
See Also

public final boolean getMetaKey ()

Gets whether the META key was depressed when the given event occurred.

Returns
  • true if META was depressed when the event occurred

public final int getMouseWheelVelocityY ()

Gets the velocity of the mouse wheel associated with the event along the Y axis.

The velocity of the event is an artifical measurement for relative comparisons of wheel activity. It is affected by some non-browser factors, including choice of input hardware and mouse acceleration settings. The sign of the velocity measurement agrees with the screen coordinate system; negative values are towards the origin and positive values are away from the origin. Standard scrolling speed is approximately ten units per event.

Returns
  • The velocity of the mouse wheel.

public final EventTarget getRelatedEventTarget ()

Gets the related target for this event.

Returns
  • the related target

public final double getRotation ()

Get the rotation in degrees, with positive values indicating clockwise rotation.

Returns
  • the rotation in degrees since the gesture started

public final double getScale ()

Get the amount scaled since the gesture started, with 1.0 representing no scaling.

Returns
  • the amount scaled since the gesture started

public final int getScreenX ()

Gets the mouse x-position on the user's display.

Returns
  • the mouse x-position

public final int getScreenY ()

Gets the mouse y-position on the user's display.

Returns
  • the mouse y-position

public final boolean getShiftKey ()

Gets whether the shift key was depressed when the given event occurred.

Returns
  • true if shift was depressed when the event occurred

public final String getString ()

Gets a string representation of this event. We do not override toString() because it is final in JavaScriptObject.

Returns
  • the string representation of this event

public final JsArray<Touch> getTargetTouches ()

Get an array of touches which have changed since the last touch event.

Returns
  • array of touches which have changed since the last touch event

public final JsArray<Touch> getTouches ()

Get an array of touches which have changed since the last touch event.

Returns
  • array of touches which have changed since the last touch event

public final String getType ()

Gets the enumerated type of this event.

Returns
  • the event's enumerated type

public final void preventDefault ()

Prevents the browser from taking its default action for the given event.

public final void stopPropagation ()

Stops the event from being propagated to parent elements.