public class MouseEvent extends UIEvent
Modifier and Type | Field and Description |
---|---|
static int |
BUTTON_LEFT
The code for left mouse button.
|
static int |
BUTTON_MIDDLE
The code for middle mouse button.
|
static int |
BUTTON_RIGHT
The code for right mouse button.
|
static String |
TYPE_CLICK
The click event type, triggered by "onclick" event handlers.
|
static String |
TYPE_CONTEXT_MENU
The context menu event type, triggered by "oncontextmenu" event handlers.
|
static String |
TYPE_DBL_CLICK
The dblclick event type, triggered by "ondblclick" event handlers.
|
static String |
TYPE_MOUSE_DOWN
The mouse down event type, triggered by "onmousedown" event handlers.
|
static String |
TYPE_MOUSE_MOVE
The mouse move event type, triggered by "onmousemove" event handlers.
|
static String |
TYPE_MOUSE_OUT
The mouse out event type, triggered by "onmouseout" event handlers.
|
static String |
TYPE_MOUSE_OVER
The mouse over event type, triggered by "onmouseover" event handlers.
|
static String |
TYPE_MOUSE_UP
The mouse up event type, triggered by "onmouseup" event handlers.
|
ALT_MASK, AT_TARGET, BLUR, BUBBLING_PHASE, CAPTURING_PHASE, CHANGE, CLICK, CONTROL_MASK, DBLCLICK, DRAGDROP, FOCUS, KEY_CURRENT_EVENT, KEYDOWN, KEYPRESS, KEYUP, META_MASK, MOUSEDOWN, MOUSEDRAG, MOUSEMOVE, MOUSEOUT, MOUSEOVER, MOUSEUP, NONE, SELECT, SHIFT_MASK, TYPE_BEFORE_UNLOAD, TYPE_BLUR, TYPE_CHANGE, TYPE_DOM_DOCUMENT_LOADED, TYPE_ERROR, TYPE_FOCUS, TYPE_FOCUS_IN, TYPE_FOCUS_OUT, TYPE_HASH_CHANGE, TYPE_INPUT, TYPE_KEY_DOWN, TYPE_KEY_PRESS, TYPE_KEY_UP, TYPE_LOAD, TYPE_MESSAGE, TYPE_POPSTATE, TYPE_PROPERTY_CHANGE, TYPE_READY_STATE_CHANGE, TYPE_RESET, TYPE_SUBMIT, TYPE_UNLOAD
Constructor and Description |
---|
MouseEvent()
Used to build the prototype.
|
MouseEvent(DomNode domNode,
String type,
boolean shiftKey,
boolean ctrlKey,
boolean altKey,
int button)
Creates a new event instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getAltKey()
Overridden to modify browser configurations.
|
int |
getButton()
Gets the button code.
|
int |
getClientX()
The horizontal coordinate at which the event occurred relative to the DOM implementation's client area.
|
int |
getClientY()
The vertical coordinate at which the event occurred relative to the DOM implementation's client area.
|
boolean |
getCtrlKey()
Overridden to modify browser configurations.
|
static MouseEvent |
getCurrentMouseEvent()
Returns the mouse event currently firing, or
null if no mouse event is being processed. |
Object |
getKeyCode()
Returns the key code associated with the event.
|
int |
getPageX()
Returns the horizontal coordinate of the event relative to whole document..
|
int |
getPageY()
Returns the vertical coordinate of the event relative to the whole document.
|
int |
getScreenX()
The horizontal coordinate at which the event occurred relative to the origin of the screen
coordinate system.
|
int |
getScreenY()
The vertical coordinate at which the event occurred relative to the origin of the screen
coordinate system.
|
boolean |
getShiftKey()
Overridden to modify browser configurations.
|
int |
getWhich()
Special for FF (old stuff from Netscape time).
|
void |
initMouseEvent(String type,
boolean bubbles,
boolean cancelable,
Object view,
int detail,
int screenX,
int screenY,
int clientX,
int clientY,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
boolean metaKey,
int button,
Object relatedTarget)
Implementation of the DOM Level 2 Event method for initializing the mouse event.
|
static boolean |
isMouseEvent(String type)
Returns
true if the specified event type should be managed as a mouse event. |
void |
setButton(int value)
Sets the button code.
|
void |
setClientX(int value)
Sets the clientX value.
|
void |
setClientY(int value)
Sets the clientY value.
|
getCancelBubble, getDetail, getMetaKey, getView, initUIEvent, setCancelBubble, setDetail, setMetaKey
applies, createPropertyChangeEvent, endFire, eventCreated, getBubbles, getCancelable, getCurrentTarget, getDefaultPrevented, getEventPhase, getPropertyName, getReturnValue, getSrcElement, getTarget, getTimeStamp, getType, initEvent, isAborted, isPropagationStopped, jsConstructor, preventDefault, setAltKey, setBubbles, setCancelable, setCtrlKey, setCurrentTarget, setEventPhase, setEventType, setKeyCode, setReturnValue, setShiftKey, setSrcElement, setTarget, setType, startFire, stopPropagation, toString
clone, equivalentValues, get, getBrowserVersion, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
defineFunctionProperties, defineProperty, getClassName, setClassName, setParentScope
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setPrototype, size
public static final String TYPE_CLICK
public static final String TYPE_DBL_CLICK
public static final String TYPE_MOUSE_OVER
public static final String TYPE_MOUSE_MOVE
public static final String TYPE_MOUSE_OUT
public static final String TYPE_MOUSE_DOWN
public static final String TYPE_MOUSE_UP
public static final String TYPE_CONTEXT_MENU
public static final int BUTTON_LEFT
public static final int BUTTON_MIDDLE
public static final int BUTTON_RIGHT
public MouseEvent()
public MouseEvent(DomNode domNode, String type, boolean shiftKey, boolean ctrlKey, boolean altKey, int button)
domNode
- the DOM node that triggered the eventtype
- the event typeshiftKey
- true if SHIFT is pressedctrlKey
- true if CTRL is pressedaltKey
- true if ALT is pressedbutton
- the button code, must be BUTTON_LEFT
, BUTTON_MIDDLE
or BUTTON_RIGHT
public int getClientX()
public void setClientX(int value)
value
- the clientX valuepublic int getScreenX()
public int getPageX()
getScreenX()
)public int getClientY()
public void setClientY(int value)
value
- the clientY valuepublic int getScreenY()
public int getPageY()
getScreenY()
)public int getButton()
public void setButton(int value)
value
- the button codepublic int getWhich()
public void initMouseEvent(String type, boolean bubbles, boolean cancelable, Object view, int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Object relatedTarget)
type
- the event typebubbles
- can the event bubblecancelable
- can the event be canceledview
- the view to use for this eventdetail
- the detail to set for the eventscreenX
- the initial value of screenXscreenY
- the initial value of screenYclientX
- the initial value of clientXclientY
- the initial value of clientYctrlKey
- is the control key pressedaltKey
- is the alt key pressedshiftKey
- is the shift key pressedmetaKey
- is the meta key pressedbutton
- what mouse button is pressedrelatedTarget
- is there a related target for the eventpublic static MouseEvent getCurrentMouseEvent()
null
if no mouse event is being processed.public static boolean isMouseEvent(String type)
true
if the specified event type should be managed as a mouse event.type
- the type of event to checktrue
if the specified event type should be managed as a mouse eventpublic boolean getAltKey()
public boolean getCtrlKey()
getCtrlKey
in class Event
public boolean getShiftKey()
getShiftKey
in class Event
public Object getKeyCode()
getKeyCode
in class Event
Copyright © 2002–2017 Gargoyle Software Inc.. All rights reserved.