Package org.apache.batik.gvt.event
Class GraphicsNodeMouseEvent
java.lang.Object
java.util.EventObject
org.apache.batik.gvt.event.GraphicsNodeEvent
org.apache.batik.gvt.event.GraphicsNodeInputEvent
org.apache.batik.gvt.event.GraphicsNodeMouseEvent
- All Implemented Interfaces:
Serializable
An event which indicates that a mouse action occurred in a graphics node.
- Version:
- $Id: GraphicsNodeMouseEvent.java 1733416 2016-03-03 07:07:13Z gadams $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
The mouse button that changed state.(package private) int
Indicates the number of quick consecutive clicks of a mouse button.(package private) int
(package private) int
static final int
The id for the "mouseClicked" event.static final int
The id for the "mouseDragged" event.static final int
The id for the "mouseEntered" event.static final int
The id for the "mouseExited" event.(package private) static final int
The first number in the range of ids used for mouse events.static final int
The id for the "mouseMoved" event.static final int
The id for the "mousePressed" event.static final int
The id for the "mouseReleased" event.(package private) GraphicsNode
Additional information.(package private) int
(package private) int
(package private) float
The graphics node mouse events x coordinate.(package private) float
The graphics node mouse events y coordinate.Fields inherited from class org.apache.batik.gvt.event.GraphicsNodeInputEvent
ALT_GRAPH_MASK, ALT_MASK, BUTTON1_MASK, BUTTON2_MASK, BUTTON3_MASK, CAPS_LOCK_MASK, CTRL_MASK, KANA_LOCK_MASK, lockState, META_MASK, modifiers, NUM_LOCK_MASK, SCROLL_LOCK_MASK, SHIFT_MASK, when
Fields inherited from class org.apache.batik.gvt.event.GraphicsNodeEvent
id
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionGraphicsNodeMouseEvent
(GraphicsNode source, int id, long when, int modifiers, int lockState, int button, float x, float y, int clientX, int clientY, int screenX, int screenY, int clickCount, GraphicsNode relatedNode) Constructs a new graphics node mouse event.GraphicsNodeMouseEvent
(GraphicsNode source, MouseEvent evt, int button, int lockState) Constructs a new graphics node mouse event from an AWT MouseEvent. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the mouse button that changed state.int
Returns the number of mouse clicks associated with this event.Returns the (x, y) position of the event relative to the screen.float
Returns the horizontal x position of the event relative to the source graphics node.float
Returns the vertical y position of the event relative to the source node.Returns the (x, y) position of the event relative to the source node.Returns the related node for thisGraphicsNodeMouseEvent
.Returns the (x, y) position of the event relative to the screen.int
Returns the horizontal x position of the event relative to the screen.int
Returns the vertical y position of the event relative to the screen.float
getX()
Returns the horizontal x position of the event relative to the source graphics node.float
getY()
Returns the vertical y position of the event relative to the source node.Methods inherited from class org.apache.batik.gvt.event.GraphicsNodeInputEvent
getLockState, getModifiers, getWhen, isAltDown, isAltGraphDown, isControlDown, isMetaDown, isShiftDown
Methods inherited from class org.apache.batik.gvt.event.GraphicsNodeEvent
consume, getGraphicsNode, getID, isConsumed
Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
MOUSE_FIRST
static final int MOUSE_FIRSTThe first number in the range of ids used for mouse events.- See Also:
-
MOUSE_CLICKED
public static final int MOUSE_CLICKEDThe id for the "mouseClicked" event. This MouseEvent occurs when a mouse button is pressed and released.- See Also:
-
MOUSE_PRESSED
public static final int MOUSE_PRESSEDThe id for the "mousePressed" event. This MouseEvent occurs when a mouse button is pushed down.- See Also:
-
MOUSE_RELEASED
public static final int MOUSE_RELEASEDThe id for the "mouseReleased" event. This MouseEvent occurs when a mouse button is let up.- See Also:
-
MOUSE_MOVED
public static final int MOUSE_MOVEDThe id for the "mouseMoved" event. This MouseMotionEvent occurs when the mouse position changes.- See Also:
-
MOUSE_ENTERED
public static final int MOUSE_ENTEREDThe id for the "mouseEntered" event. This MouseEvent occurs when the mouse cursor enters a graphics node's area.- See Also:
-
MOUSE_EXITED
public static final int MOUSE_EXITEDThe id for the "mouseExited" event. This MouseEvent occurs when the mouse cursor leaves a graphics node's area.- See Also:
-
MOUSE_DRAGGED
public static final int MOUSE_DRAGGEDThe id for the "mouseDragged" event. This MouseEvent occurs when the mouse position changes while the "drag" modifier is active (for example, the shift key).- See Also:
-
x
float xThe graphics node mouse events x coordinate. The x value is relative to the graphics node that fired the event. -
y
float yThe graphics node mouse events y coordinate. The y value is relative to the graphics node that fired the event. -
clientX
int clientX -
clientY
int clientY -
screenX
int screenX -
screenY
int screenY -
clickCount
int clickCountIndicates the number of quick consecutive clicks of a mouse button. -
button
int buttonThe mouse button that changed state.
-
-
Constructor Details
-
GraphicsNodeMouseEvent
public GraphicsNodeMouseEvent(GraphicsNode source, int id, long when, int modifiers, int lockState, int button, float x, float y, int clientX, int clientY, int screenX, int screenY, int clickCount, GraphicsNode relatedNode) Constructs a new graphics node mouse event.- Parameters:
source
- the graphics node where the event originatedid
- the id of this eventwhen
- the time the event occurredmodifiers
- the modifier keys down when event occurredlockState
- the lock keys active when the event occurredbutton
- the mouse button that changed statex
- the mouse x coordinatey
- the mouse y coordinatescreenX
- the mouse x coordinate relative to the screenscreenY
- the mouse y coordinate relative to the screenclickCount
- the number of clicksrelatedNode
- the related node- See Also:
-
GraphicsNodeMouseEvent
Constructs a new graphics node mouse event from an AWT MouseEvent.- Parameters:
source
- the source where the event originatedevt
- the AWT mouse event which is the source of this GraphicsNodeEvent
-
-
Method Details
-
getButton
public int getButton()Returns the mouse button that changed state. -
getX
public float getX()Returns the horizontal x position of the event relative to the source graphics node.- Returns:
- x a float indicating horizontal position relative to the node
-
getY
public float getY()Returns the vertical y position of the event relative to the source node.- Returns:
- y a float indicating vertical position relative to the node
-
getClientX
public float getClientX()Returns the horizontal x position of the event relative to the source graphics node.- Returns:
- x a float indicating horizontal position relative to the node
-
getClientY
public float getClientY()Returns the vertical y position of the event relative to the source node.- Returns:
- y a float indicating vertical position relative to the node
-
getScreenX
public int getScreenX()Returns the horizontal x position of the event relative to the screen.- Returns:
- x a float indicating horizontal position relative to the screen
-
getScreenY
public int getScreenY()Returns the vertical y position of the event relative to the screen.- Returns:
- y a float indicating vertical position relative to the screen
-
getScreenPoint
Returns the (x, y) position of the event relative to the screen.- Returns:
- a Point object containing the x and y coordinates
-
getClientPoint
Returns the (x, y) position of the event relative to the screen.- Returns:
- a Point object containing the x and y coordinates
-
getPoint2D
Returns the (x, y) position of the event relative to the source node.- Returns:
- a Point object containing the x and y coordinates
-
getClickCount
public int getClickCount()Returns the number of mouse clicks associated with this event.- Returns:
- integer value for the number of clicks
-
getRelatedNode
Returns the related node for thisGraphicsNodeMouseEvent
. For aMOUSE_ENTERED
event it is the previous node target, for aMOUSE_EXITED
event it is the next node target and for aMOUSE_DRAGGED
event it is the node under the mouse pointer. Otherwise the value isnull
.
-