Class MouseEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DropEvent
There are two possible way to identify a mouse event.
One is by coordinate (getX() and getY().
The other is by a logical name, called area (getArea()).
- Author:
- tomyeh
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates whether the Alt key is pressed.static final intIndicates whether the Ctrl key is pressed.static final intIndicates whether the left button is clicked.static final intIndicates whether the Meta key is pressed.static final intIndicates whether the middle button is clicked.static final intIndicates whether the right button is clicked.static final intIndicates whether the Shift key is pressed. -
Constructor Summary
ConstructorsConstructorDescriptionMouseEvent(String name, Component target) Construct a mouse relevant event with coordinate or area.MouseEvent(String name, Component target, int x, int y, int pageX, int pageY) Constructs a mouse relevant event.MouseEvent(String name, Component target, int x, int y, int pageX, int pageY, int keys) Constructs a mouse relevant event.MouseEvent(String name, Component target, String area, int keys) Constructs a mouse relevant event with a logic name called area. -
Method Summary
Modifier and TypeMethodDescriptiongetArea()Returns the logical name of the area that the click occurs, or null if not available.Returns the component representing the area that the click occurs, or null if not associated with any component.final intgetKeys()Returns what keys were pressed when the mouse is clicked, or 0 if none of them was pressed.static MouseEventgetMouseEvent(AuRequest request) Converts an AU request to a mouse event.final intgetPageX()Returns the horizontal coordinate of the mouse pointer relative to the whole document.final intgetPageY()Returns the vertical coordinate of the mouse pointer relative to the whole document.final intgetX()Returns the horizontal coordinate of the mouse pointer relevant to the component.final intgetY()Returns the vertical coordinate of the mouse pointer relevant to the component.Methods inherited from class org.zkoss.zk.ui.event.Event
getData, getEvent, getName, getPage, getTarget, isPropagatable, stopPropagation, toString
-
Field Details
-
ALT_KEY
public static final int ALT_KEYIndicates whether the Alt key is pressed. It might be returned as part ofgetKeys().- See Also:
-
CTRL_KEY
public static final int CTRL_KEYIndicates whether the Ctrl key is pressed. It might be returned as part ofgetKeys().- See Also:
-
SHIFT_KEY
public static final int SHIFT_KEYIndicates whether the Shift key is pressed. It might be returned as part ofgetKeys().- See Also:
-
META_KEY
public static final int META_KEYIndicates whether the Meta key is pressed. It might be returned as part ofgetKeys().- Since:
- 8.0.2
- See Also:
-
LEFT_CLICK
public static final int LEFT_CLICKIndicates whether the left button is clicked.- See Also:
-
RIGHT_CLICK
public static final int RIGHT_CLICKIndicates whether the right button is clicked.- See Also:
-
MIDDLE_CLICK
public static final int MIDDLE_CLICKIndicates whether the middle button is clicked.- Since:
- 5.0.0
- See Also:
-
-
Constructor Details
-
MouseEvent
Construct a mouse relevant event with coordinate or area. -
MouseEvent
Constructs a mouse relevant event.- Since:
- 5.0.0
-
MouseEvent
Constructs a mouse relevant event.- Parameters:
keys- a combination ofCTRL_KEY,SHIFT_KEYALT_KEY,LEFT_CLICKandRIGHT_CLICK.- Since:
- 5.0.0
-
MouseEvent
Constructs a mouse relevant event with a logic name called area.- Since:
- 5.0.0
-
-
Method Details
-
getMouseEvent
Converts an AU request to a mouse event.- Since:
- 5.0.0
-
getArea
Returns the logical name of the area that the click occurs, or null if not available.It is used only with some special components, that partition itself into several logical areas.
For example,
imagemapandchartpartition an image into multiple sections represented with the area component (Area).If each partition is represented with
Area, the return value isAbstractComponent.getId(), if it is assigned, orAbstractComponent.getUuid()if not assigned. To simplify the access, you can retrieve it back withgetAreaComponent().- See Also:
-
getAreaComponent
Returns the component representing the area that the click occurs, or null if not associated with any component.This method assumes
getArea()is either a component's ID or a component's UUID. It is true whenAreais used to partition a component, such asImagemapandChart.- Since:
- 5.0.4
-
getX
public final int getX()Returns the horizontal coordinate of the mouse pointer relevant to the component. -
getY
public final int getY()Returns the vertical coordinate of the mouse pointer relevant to the component. -
getPageX
public final int getPageX()Returns the horizontal coordinate of the mouse pointer relative to the whole document.- Since:
- 5.0.0
-
getPageY
public final int getPageY()Returns the vertical coordinate of the mouse pointer relative to the whole document.- Since:
- 5.0.0
-
getKeys
public final int getKeys()Returns what keys were pressed when the mouse is clicked, or 0 if none of them was pressed. It is a combination ofCTRL_KEY,SHIFT_KEYALT_KEY,LEFT_CLICKandRIGHT_CLICK.
-