org.apache.batik.gvt.event

Class GraphicsNodeMouseEvent

public class GraphicsNodeMouseEvent extends GraphicsNodeInputEvent

An event which indicates that a mouse action occurred in a graphics node.
Field Summary
static intMOUSE_CLICKED
The id for the "mouseClicked" event.
static intMOUSE_DRAGGED
The id for the "mouseDragged" event.
static intMOUSE_ENTERED
The id for the "mouseEntered" event.
static intMOUSE_EXITED
The id for the "mouseExited" event.
static intMOUSE_MOVED
The id for the "mouseMoved" event.
static intMOUSE_PRESSED
The id for the "mousePressed" event.
static intMOUSE_RELEASED
The id for the "mouseReleased" event.
Constructor Summary
GraphicsNodeMouseEvent(GraphicsNode source, int id, long when, int modifiers, int lockState, 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 lockState)
Constructs a new graphics node mouse event from an AWT MouseEvent.
Method Summary
intgetClickCount()
Returns the number of mouse clicks associated with this event.
PointgetClientPoint()
Returns the (x, y) position of the event relative to the screen.
floatgetClientX()
Returns the horizontal x position of the event relative to the source graphics node.
floatgetClientY()
Returns the vertical y position of the event relative to the source node.
Point2DgetPoint2D()
Returns the (x, y) position of the event relative to the source node.
GraphicsNodegetRelatedNode()
Returns the related node for this GraphicsNodeMouseEvent.
PointgetScreenPoint()
Returns the (x, y) position of the event relative to the screen.
intgetScreenX()
Returns the horizontal x position of the event relative to the screen.
intgetScreenY()
Returns the vertical y position of the event relative to the screen.
floatgetX()
Returns the horizontal x position of the event relative to the source graphics node.
floatgetY()
Returns the vertical y position of the event relative to the source node.

Field Detail

MOUSE_CLICKED

public static final int MOUSE_CLICKED
The id for the "mouseClicked" event. This MouseEvent occurs when a mouse button is pressed and released.

MOUSE_DRAGGED

public static final int MOUSE_DRAGGED
The id for the "mouseDragged" event. This MouseEvent occurs when the mouse position changes while the "drag" modifier is active (for example, the shift key).

MOUSE_ENTERED

public static final int MOUSE_ENTERED
The id for the "mouseEntered" event. This MouseEvent occurs when the mouse cursor enters a graphics node's area.

MOUSE_EXITED

public static final int MOUSE_EXITED
The id for the "mouseExited" event. This MouseEvent occurs when the mouse cursor leaves a graphics node's area.

MOUSE_MOVED

public static final int MOUSE_MOVED
The id for the "mouseMoved" event. This MouseMotionEvent occurs when the mouse position changes.

MOUSE_PRESSED

public static final int MOUSE_PRESSED
The id for the "mousePressed" event. This MouseEvent occurs when a mouse button is pushed down.

MOUSE_RELEASED

public static final int MOUSE_RELEASED
The id for the "mouseReleased" event. This MouseEvent occurs when a mouse button is let up.

Constructor Detail

GraphicsNodeMouseEvent

public GraphicsNodeMouseEvent(GraphicsNode source, int id, long when, int modifiers, int lockState, 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 originated id the id of this event when the time the event occurred modifiers the modifier keys down while event occurred x the mouse x coordinate y the mouse y coordinate screenX the mouse x coordinate relative to the screen screenY the mouse y coordinate relative to the screen clickCount the number of clicks relatedNode the related node

See Also: GraphicsNodeMouseEvent

GraphicsNodeMouseEvent

public GraphicsNodeMouseEvent(GraphicsNode source, MouseEvent evt, int lockState)
Constructs a new graphics node mouse event from an AWT MouseEvent.

Parameters: source the source where the event originated evt the AWT mouse event which is the source of this GraphicsNodeEvent

Method Detail

getClickCount

public int getClickCount()
Returns the number of mouse clicks associated with this event.

Returns: integer value for the number of clicks

getClientPoint

public Point getClientPoint()
Returns the (x, y) position of the event relative to the screen.

Returns: a Point object containing the x and y coordinates

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

getPoint2D

public Point2D getPoint2D()
Returns the (x, y) position of the event relative to the source node.

Returns: a Point object containing the x and y coordinates

getRelatedNode

public GraphicsNode getRelatedNode()
Returns the related node for this GraphicsNodeMouseEvent. For a MOUSE_ENTERED event it is the previous node target, for a MOUSE_EXITED event it is the next node target and for a MOUSE_DRAGGED event it is the node under the mouse pointer. Otherwise the value is null.

getScreenPoint

public Point getScreenPoint()
Returns the (x, y) position of the event relative to the screen.

Returns: a Point object containing the x and y coordinates

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

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

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.