Mouse Events
- a mouse button is pressed
- a mouse button is released
- a mouse button is clicked (pressed and released)
- the mouse cursor enters a node
- the mouse cursor exits a node
A ZMouseEvent object is passed to every ZMouseListener
or ZMouseAdapter
object which registered to receive the "interesting" mouse events using the component's addMouseListener
method. (ZMouseAdapter
objects implement the ZMouseListener
interface.) Each such listener object gets a ZMouseEvent
containing the mouse event.
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
- See Also:
-
ZMouseAdapter
, ZMouseListener
, Serialized Form
Fields inherited from class java.awt.event.MouseEvent |
BUTTON1, BUTTON2, BUTTON3, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_FIRST, MOUSE_LAST, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_WHEEL, NOBUTTON |
Fields inherited from class java.awt.event.InputEvent |
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASK |
Fields inherited from class java.awt.event.ComponentEvent |
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN |
Fields inherited from class java.awt.AWTEvent |
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK |
Fields inherited from class java.util.EventObject |
source |
Constructor Summary |
|
ZMouseEvent(int id, java.awt.event.MouseEvent e, ZSceneGraphPath aGrabPath, ZSceneGraphPath aCurrentPath)
Deprecated. as of Jazz 1.1, use createMouseEvent() instead.
|
protected |
ZMouseEvent(int id, java.awt.event.MouseEvent e, ZSceneGraphPath aGrabPath, ZSceneGraphPath aCurrentPath, java.lang.Object dummy)
|
|
ZMouseEvent(int id, ZNode aNode, java.awt.event.MouseEvent e, ZSceneGraphPath aGrabPath)
Deprecated. as of Jazz 1.1, use createMouseEvent() instead.
|
Method Summary |
static ZMouseEvent |
createMouseEvent(int id, java.awt.event.MouseEvent e, ZSceneGraphPath path, ZSceneGraphPath mouseOverPath)
Creates and returns a new ZMouse event from a Java MouseEvent. |
void |
dispatchTo(java.lang.Object listener)
Calls appropriate method on the listener based on this events ID. |
ZNode |
getCurrentNode()
Get the current node that is under the cursor. |
ZSceneGraphPath |
getCurrentPath()
Get the path from the ZCanvas down to the visual component currently under the mouse.This may give a different result then getGrabPath() durring a MOUSE_DRAGGED or MOUSE_RELEASED operation. |
ZNode |
getGrabNode()
Determine the node the event originated at. |
ZSceneGraphPath |
getGrabPath()
Return the path from the ZCanvas down to the currently grabbed object. |
int |
getID()
Determine the event type. |
java.lang.Class |
getListenerType()
Returns the ZMouseLister class. |
java.awt.geom.Point2D |
getLocalPoint()
Returns the x,y position of the event in the local coordinate system of the node the event occurred on. |
double |
getLocalX()
Returns the horizontal x position of the event in the local coordinate system of the node the event occurred on. |
double |
getLocalY()
Returns the vertical y position of the event in the local coordinate system of the node the event occurred on. |
ZNode |
getNode()
Determine the node the event originated at. |
ZSceneGraphPath |
getPath()
Determine the path the event took from the ZCanvas down to the visual component. |
void |
setSource(java.lang.Object aSource)
Set the souce of this event. |
Methods inherited from class java.awt.event.MouseEvent |
getButton, getClickCount, getMouseModifiersText, getPoint, getX, getY, isPopupTrigger, paramString, translatePoint |
Methods inherited from class java.awt.event.InputEvent |
consume, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown |
Methods inherited from class java.awt.event.ComponentEvent |
getComponent |
Methods inherited from class java.awt.AWTEvent |
toString |
Methods inherited from class java.util.EventObject |
getSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ZMouseEvent
public ZMouseEvent(int id,
java.awt.event.MouseEvent e,
ZSceneGraphPath aGrabPath,
ZSceneGraphPath aCurrentPath)
-
Deprecated. as of Jazz 1.1, use createMouseEvent() instead.
-
Constructs a new ZMouse event from a Java MouseEvent.
- Parameters:
-
id
- The event type (MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_CLICKED, MOUSE_ENTERED, MOUSE_EXITED)
-
e
- The original Java mouse event
ZMouseEvent
public ZMouseEvent(int id,
ZNode aNode,
java.awt.event.MouseEvent e,
ZSceneGraphPath aGrabPath)
-
Deprecated. as of Jazz 1.1, use createMouseEvent() instead.
ZMouseEvent
protected ZMouseEvent(int id,
java.awt.event.MouseEvent e,
ZSceneGraphPath aGrabPath,
ZSceneGraphPath aCurrentPath,
java.lang.Object dummy)
createMouseEvent
public static ZMouseEvent createMouseEvent(int id,
java.awt.event.MouseEvent e,
ZSceneGraphPath path,
ZSceneGraphPath mouseOverPath)
-
Creates and returns a new ZMouse event from a Java MouseEvent.
-
-
- Parameters:
-
id
- The event type (MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_CLICKED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_MOVED, MOUSE_DRAGGED)
-
e
- The original Java mouse event
-
path
- The path to use for getNode() and getPath()
-
mouseOverPath
- The path to the current node under the mouse, this may be differnt then the normal path when in MOUSE_DRAGGED and MOUSE_RELEASED events.
getLocalPoint
public java.awt.geom.Point2D getLocalPoint()
-
Returns the x,y position of the event in the local coordinate system of the node the event occurred on.
-
-
- Returns:
- a Point2D object containing the x and y coordinates local to the node.
getLocalX
public double getLocalX()
-
Returns the horizontal x position of the event in the local coordinate system of the node the event occurred on.
-
-
- Returns:
- x a double indicating horizontal position local to the node.
getLocalY
public double getLocalY()
-
Returns the vertical y position of the event in the local coordinate system of the node the event occurred on.
-
-
- Returns:
- y a double indicating vertical position local to the node.
getID
public int getID()
-
Determine the event type.
-
- Overrides:
-
getID
in class java.awt.AWTEvent
-
- Returns:
- the id
getNode
public ZNode getNode()
-
Determine the node the event originated at. If an event percolates up the tree and is handled by an event listener higher up in the tree than the original node that generated the event, this returns the original node. For mouse drag and release events, this is the node that the original matching press event went to - in other words, the event is 'grabbed' by the originating node.
-
-
- Returns:
- the node
getPath
public ZSceneGraphPath getPath()
-
Determine the path the event took from the ZCanvas down to the visual component.
-
-
- Returns:
- the path
getGrabNode
public ZNode getGrabNode()
-
Determine the node the event originated at. If an event percolates up the tree and is handled by an event listener higher up in the tree than the original node that generated the event, this returns the original node. For mouse drag and release events, this is the node that the original matching press event went to - in other words, the event is 'grabbed' by the originating node.
-
-
- Returns:
- the node
getGrabPath
public ZSceneGraphPath getGrabPath()
-
Return the path from the ZCanvas down to the currently grabbed object.
-
-
- Returns:
- the path
getCurrentNode
public ZNode getCurrentNode()
-
Get the current node that is under the cursor. This may return a different result then getGrabNode() when in a MOUSE_RELEASED or MOUSE_DRAGGED event.
-
-
- Returns:
- the current node.
getCurrentPath
public ZSceneGraphPath getCurrentPath()
-
Get the path from the ZCanvas down to the visual component currently under the mouse.This may give a different result then getGrabPath() durring a MOUSE_DRAGGED or MOUSE_RELEASED operation.
-
-
- Returns:
- the current path.
dispatchTo
public void dispatchTo(java.lang.Object listener)
-
Calls appropriate method on the listener based on this events ID.
-
- Specified by:
-
dispatchTo
in interface ZEvent
-
getListenerType
public java.lang.Class getListenerType()
-
Returns the ZMouseLister class.
-
- Specified by:
-
getListenerType
in interface ZEvent
-
setSource
public void setSource(java.lang.Object aSource)
-
Set the souce of this event. As the event is fired up the tree the source of the event will keep changing to reflect the scenegraph object that is firing the event.
-
- Specified by:
-
setSource
in interface ZEvent
- Overrides:
-
setSource
in class java.awt.AWTEvent
-
Copyright � 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.