MouseEvent interface provides specific contextual
information associated with Mouse events.
The detail attribute inherited from UIEvent
indicates the number of times a mouse button has been pressed and
released over the same screen location during a user action. The
attribute value is 1 when the user begins this action and increments by 1
for each full sequence of pressing and releasing. If the user moves the
mouse between the mousedown and mouseup the value will be set to 0,
indicating that no click is occurring.
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 its descendent elements.
See also the Document Object Model (DOM) Level 2 Events Specification.
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public short | getButton()
During mouse events caused by the depression or release of a mouse
button, |
| public int | getClientX()
The horizontal coordinate at which the event occurred relative to the DOM implementation's client area. |
| public int | getClientY()
The vertical coordinate at which the event occurred relative to the DOM implementation's client area. |
| public boolean | |
| public boolean | |
| public EventTarget | |
| public int | getScreenX()
The horizontal coordinate at which the event occurred relative to the origin of the screen coordinate system. |
| public int | getScreenY()
The vertical coordinate at which the event occurred relative to the origin of the screen coordinate system. |
| public boolean | |
| public void | initMouseEvent(String
Specifies the event type. typeArg, boolean Specifies whether or not the event can bubble. canBubbleArg, boolean Specifies whether or not the event's default
action can be prevented. cancelableArg, AbstractView Specifies the viewArg, int Event's
AbstractView.Specifies the detailArg, int Event's mouse click count.Specifies the screenXArg, int Event's screen x
coordinateSpecifies the screenYArg, int Event's screen y
coordinateSpecifies the clientXArg, int Event's client x
coordinateSpecifies the clientYArg, boolean Event's client y
coordinateSpecifies whether or not control key was depressed
during the ctrlKeyArg, boolean Event.Specifies whether or not alt key was depressed during
the altKeyArg, boolean Event.Specifies whether or not shift key was depressed
during the shiftKeyArg, boolean Event.Specifies whether or not meta key was depressed
during the metaKeyArg, short Event.Specifies the buttonArg, EventTarget Event's mouse button.Specifies the relatedTargetArg)Event's related
EventTarget.The |
| getAltKey | back to summary |
|---|---|
| public boolean getAltKey() Used to indicate whether the 'alt' key was depressed during the firing of the event. On some platforms this key may map to an alternative key name. | |
| getButton | back to summary |
|---|---|
| public short getButton() During mouse events caused by the depression or release of a mouse
button, | |
| getClientX | back to summary |
|---|---|
| public int getClientX() The horizontal coordinate at which the event occurred relative to the DOM implementation's client area. | |
| getClientY | back to summary |
|---|---|
| public int getClientY() The vertical coordinate at which the event occurred relative to the DOM implementation's client area. | |
| getCtrlKey | back to summary |
|---|---|
| public boolean getCtrlKey() Used to indicate whether the 'ctrl' key was depressed during the firing of the event. | |
| getMetaKey | back to summary |
|---|---|
| public boolean getMetaKey() Used to indicate whether the 'meta' key was depressed during the firing of the event. On some platforms this key may map to an alternative key name. | |
| getRelatedTarget | back to summary |
|---|---|
| public EventTarget getRelatedTarget() Used to identify a secondary | |
| getScreenX | back to summary |
|---|---|
| public int getScreenX() The horizontal coordinate at which the event occurred relative to the origin of the screen coordinate system. | |
| getScreenY | back to summary |
|---|---|
| public int getScreenY() The vertical coordinate at which the event occurred relative to the origin of the screen coordinate system. | |
| getShiftKey | back to summary |
|---|---|
| public boolean getShiftKey() Used to indicate whether the 'shift' key was depressed during the firing of the event. | |
| initMouseEvent | back to summary |
|---|---|
| public void initMouseEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, int detailArg, int screenXArg, int screenYArg, int clientXArg, int clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, EventTarget relatedTargetArg) The
| |