Package com.google.gwt.event.dom.client
Class MouseEvent<H extends EventHandler>
- java.lang.Object
-
- com.google.web.bindery.event.shared.Event<H>
-
- com.google.gwt.event.shared.GwtEvent<H>
-
- com.google.gwt.event.dom.client.DomEvent<H>
-
- com.google.gwt.event.dom.client.HumanInputEvent<H>
-
- com.google.gwt.event.dom.client.MouseEvent<H>
-
- Type Parameters:
H- handler type
- All Implemented Interfaces:
HasNativeEvent
- Direct Known Subclasses:
ClickEvent,DoubleClickEvent,MouseDownEvent,MouseMoveEvent,MouseOutEvent,MouseOverEvent,MouseUpEvent,MouseWheelEvent
public abstract class MouseEvent<H extends EventHandler> extends HumanInputEvent<H>
Abstract class representing mouse events.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.gwt.event.dom.client.DomEvent
DomEvent.Type<H extends EventHandler>
-
-
Constructor Summary
Constructors Constructor Description MouseEvent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetClientX()Gets the mouse x-position within the browser window's client area.intgetClientY()Gets the mouse y-position within the browser window's client area.intgetNativeButton()Gets the button value.intgetRelativeX(Element target)Gets the mouse x-position relative to a given element.intgetRelativeY(Element target)Gets the mouse y-position relative to a given element.intgetScreenX()Gets the mouse x-position on the user's display.intgetScreenY()Gets the mouse y-position on the user's display.intgetX()Gets the mouse x-position relative to the event's current target element.intgetY()Gets the mouse y-position relative to the event's current target element.-
Methods inherited from class com.google.gwt.event.dom.client.HumanInputEvent
isAltKeyDown, isControlKeyDown, isMetaKeyDown, isShiftKeyDown
-
Methods inherited from class com.google.gwt.event.dom.client.DomEvent
fireNativeEvent, fireNativeEvent, getAssociatedType, getNativeEvent, getRelativeElement, init, preventDefault, setNativeEvent, setRelativeElement, stopPropagation
-
Methods inherited from class com.google.gwt.event.shared.GwtEvent
assertLive, dispatch, getSource, isLive, kill, revive
-
Methods inherited from class com.google.web.bindery.event.shared.Event
setSource, toDebugString, toString
-
-
-
-
Method Detail
-
getClientX
public int getClientX()
Gets the mouse x-position within the browser window's client area.- Returns:
- the mouse x-position
-
getClientY
public int getClientY()
Gets the mouse y-position within the browser window's client area.- Returns:
- the mouse y-position
-
getNativeButton
public int getNativeButton()
Gets the button value. Compare it toNativeEvent.BUTTON_LEFT,NativeEvent.BUTTON_RIGHT,NativeEvent.BUTTON_MIDDLENote: this is unreliable for events not caused by the depression or release of a mouse button.
- Returns:
- the button value
-
getRelativeX
public int getRelativeX(Element target)
Gets the mouse x-position relative to a given element.- Parameters:
target- the element whose coordinate system is to be used- Returns:
- the relative x-position
-
getRelativeY
public int getRelativeY(Element target)
Gets the mouse y-position relative to a given element.- Parameters:
target- the element whose coordinate system is to be used- Returns:
- the relative y-position
-
getScreenX
public int getScreenX()
Gets the mouse x-position on the user's display.- Returns:
- the mouse x-position
-
getScreenY
public int getScreenY()
Gets the mouse y-position on the user's display.- Returns:
- the mouse y-position
-
getX
public int getX()
Gets the mouse x-position relative to the event's current target element.- Returns:
- the relative x-position
-
getY
public int getY()
Gets the mouse y-position relative to the event's current target element.- Returns:
- the relative y-position
-
-