FileDocCategorySizeDatePackage
MouseEvent.javaAPI DocAndroid 1.5 API6943Wed May 06 22:42:46 BST 2009org.w3c.dom.events

MouseEvent

public interface MouseEvent implements UIEvent
The MouseEvent interface provides specific contextual information associated with Mouse events.

In the case of nested elements mouse events are always targeted at the most deeply nested element. Ancestors of the targeted element may use bubbling to obtain notification of mouse events which occur within their descendent elements.

To create an instance of the MouseEvent interface, use the DocumentEvent.createEvent("MouseEvent") method call.

Note: When initializing MouseEvent objects using initMouseEvent or initMouseEventNS, implementations should use the client coordinates clientX and clientY for calculation of other coordinates (such as target coordinates exposed by DOM Level 0 implementations).

See also the Document Object Model (DOM) Level 3 Events Specification .

since
DOM Level 2

Fields Summary
Constructors Summary
Methods Summary
public booleangetAltKey()
Refer to the KeyboardEvent.altKey attribute.

public shortgetButton()
During mouse events caused by the depression or release of a mouse button, button is used to indicate which mouse button changed state. 0 indicates the normal button of the mouse (in general on the left or the one button on Macintosh mice, used to activate a button or select text). 2 indicates the contextual property (in general on the right, used to display a context menu) button of the mouse if present. 1 indicates the extra (in general in the middle and often combined with the mouse wheel) button. Some mice may provide or simulate more buttons, and values higher than 2 can be used to represent such buttons.

public intgetClientX()
The horizontal coordinate at which the event occurred relative to the viewport associated with the event.

public intgetClientY()
The vertical coordinate at which the event occurred relative to the viewport associated with the event.

public booleangetCtrlKey()
Refer to the KeyboardEvent.ctrlKey attribute.

public booleangetMetaKey()
Refer to the KeyboardEvent.metaKey attribute.

public org.w3c.dom.events.EventTargetgetRelatedTarget()
Used to identify a secondary EventTarget related to a UI event, depending on the type of event.

public intgetScreenX()
The horizontal coordinate at which the event occurred relative to the origin of the screen coordinate system.

public intgetScreenY()
The vertical coordinate at which the event occurred relative to the origin of the screen coordinate system.

public booleangetShiftKey()
Refer to the KeyboardEvent.shiftKey attribute.

public voidinitMouseEvent(java.lang.String typeArg, boolean canBubbleArg, boolean cancelableArg, org.w3c.dom.views.AbstractView viewArg, int detailArg, int screenXArg, int screenYArg, int clientXArg, int clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, org.w3c.dom.events.EventTarget relatedTargetArg)
Initializes attributes of a MouseEvent object. This method has the same behavior as UIEvent.initUIEvent().

param
typeArg Refer to the UIEvent.initUIEvent() method for a description of this parameter.
param
canBubbleArg Refer to the UIEvent.initUIEvent() method for a description of this parameter.
param
cancelableArg Refer to the UIEvent.initUIEvent() method for a description of this parameter.
param
viewArg Refer to the UIEvent.initUIEvent() method for a description of this parameter.
param
detailArg Refer to the UIEvent.initUIEvent() method for a description of this parameter.
param
screenXArg Specifies MouseEvent.screenX.
param
screenYArg Specifies MouseEvent.screenY.
param
clientXArg Specifies MouseEvent.clientX.
param
clientYArg Specifies MouseEvent.clientY.
param
ctrlKeyArg Specifies MouseEvent.ctrlKey.
param
altKeyArg Specifies MouseEvent.altKey.
param
shiftKeyArg Specifies MouseEvent.shiftKey.
param
metaKeyArg Specifies MouseEvent.metaKey.
param
buttonArg Specifies MouseEvent.button.
param
relatedTargetArg Specifies MouseEvent.relatedTarget. This value may be null.