edu.umd.cs.jazz.event
Class ZSwingEventHandler

java.lang.Object
  |
  +--edu.umd.cs.jazz.event.ZSwingEventHandler
All Implemented Interfaces:
java.util.EventListener, ZEventHandler, ZMouseListener, ZMouseMotionListener

public class ZSwingEventHandler
extends java.lang.Object
implements ZEventHandler, ZMouseListener, ZMouseMotionListener

Event handler to send MousePressed, MouseReleased, MouseMoved, MouseClicked, and MouseDragged events on Swing components within a ZCanvas

Author:
Ben Bederson, Lance Good
See Also:
ZMouseAdapter, ZMouseEvent, ZMouseListener, ZMouseMotionListener

Field Summary
protected  boolean active
          True when event handlers are set active.
protected  ZNode listenNode
          The node to listen to for events.
 
Constructor Summary
ZSwingEventHandler(ZCanvas canvas)
          Constructs a new ZSwingEventHandler for the given canvas.
ZSwingEventHandler(ZCanvas canvas, ZNode node)
          Constructs a new ZSwingEventHandler for the given canvas, and a node that will recieve the mouse events.
 
Method Summary
 boolean isActive()
          Determines if this event handler is active.
 void mouseClicked(ZMouseEvent e1)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(ZMouseEvent e1)
          Invoked when a mouse button is pressed on a node and then dragged.
 void mouseEntered(ZMouseEvent e1)
          Invoked when the mouse enters a component.
 void mouseExited(ZMouseEvent e1)
          Invoked when the mouse exits a component.
 void mouseMoved(ZMouseEvent e1)
          Invoked when the mouse button has been moved on a node (with no buttons no down).
 void mousePressed(ZMouseEvent e1)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(ZMouseEvent e1)
          Invoked when a mouse button has been released on a component.
 void setActive(boolean active)
          Specifies whether this event handler is active or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenNode

protected ZNode listenNode
The node to listen to for events.

active

protected boolean active
True when event handlers are set active.
Constructor Detail

ZSwingEventHandler

public ZSwingEventHandler(ZCanvas canvas,
                          ZNode node)
Constructs a new ZSwingEventHandler for the given canvas, and a node that will recieve the mouse events.
Parameters:
canvas - the canvas associated with this ZSwingEventHandler.
node - the node the mouse listeners will be attached to.

ZSwingEventHandler

public ZSwingEventHandler(ZCanvas canvas)
Constructs a new ZSwingEventHandler for the given canvas.
Method Detail

setActive

public void setActive(boolean active)
Description copied from interface: ZEventHandler
Specifies whether this event handler is active or not.
Specified by:
setActive in interface ZEventHandler
Following copied from interface: edu.umd.cs.jazz.event.ZEventHandler
Parameters:
active - True to make this event handler active

isActive

public boolean isActive()
Determines if this event handler is active.
Specified by:
isActive in interface ZEventHandler
Returns:
True if active

mousePressed

public void mousePressed(ZMouseEvent e1)
Description copied from interface: ZMouseListener
Invoked when a mouse button has been pressed on a component.
Specified by:
mousePressed in interface ZMouseListener

mouseReleased

public void mouseReleased(ZMouseEvent e1)
Description copied from interface: ZMouseListener
Invoked when a mouse button has been released on a component.
Specified by:
mouseReleased in interface ZMouseListener

mouseClicked

public void mouseClicked(ZMouseEvent e1)
Description copied from interface: ZMouseListener
Invoked when the mouse has been clicked on a component.
Specified by:
mouseClicked in interface ZMouseListener

mouseExited

public void mouseExited(ZMouseEvent e1)
Description copied from interface: ZMouseListener
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface ZMouseListener

mouseEntered

public void mouseEntered(ZMouseEvent e1)
Description copied from interface: ZMouseListener
Invoked when the mouse enters a component.
Specified by:
mouseEntered in interface ZMouseListener

mouseMoved

public void mouseMoved(ZMouseEvent e1)
Description copied from interface: ZMouseMotionListener
Invoked when the mouse button has been moved on a node (with no buttons no down).
Specified by:
mouseMoved in interface ZMouseMotionListener

mouseDragged

public void mouseDragged(ZMouseEvent e1)
Description copied from interface: ZMouseMotionListener
Invoked when a mouse button is pressed on a node and then dragged. Mouse drag events will continue to be delivered to the node where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the node).
Specified by:
mouseDragged in interface ZMouseMotionListener


Copyright © 2001 by University of Maryland, College Park, MD 20742, USA All rights reserved.