com.rolemodelsoft.drawlet.basics
Class CanvasTool

java.lang.Object
  |
  +--com.rolemodelsoft.drawlet.basics.AbstractInputEventHandler
        |
        +--com.rolemodelsoft.drawlet.basics.CanvasTool
Direct Known Subclasses:
ConstructionTool, SelectionTool

public abstract class CanvasTool
extends AbstractInputEventHandler

This abstract class offers a simple base for Tools attached to a DrawingCanvas Subclasses would typically provide a constructor that takes a DrawingCanvas as an argument.


Field Summary
protected  DrawingCanvas canvas
          The canvas upon which to "operate"
 
Constructor Summary
CanvasTool()
           
 
Method Summary
protected  int getX(java.awt.event.MouseEvent evt)
          Returns the proper x value for the given event.
protected  int getY(java.awt.event.MouseEvent evt)
          Returns the proper y value for the given event.
 void mouseReleased(java.awt.event.MouseEvent e)
          Called if the mouse is released.
 
Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractInputEventHandler
keyPressed, keyReleased, keyTyped, mouseClicked, mouseDoubleClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseSingleClicked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvas

protected DrawingCanvas canvas
The canvas upon which to "operate"
Constructor Detail

CanvasTool

public CanvasTool()
Method Detail

getX

protected int getX(java.awt.event.MouseEvent evt)
Returns the proper x value for the given event.
Parameters:
evt - the MouseEvent to get the corrected x for.
Returns:
an integer representing the proper x coordinate.

getY

protected int getY(java.awt.event.MouseEvent evt)
Returns the proper y value for the given event.
Parameters:
evt - the MouseEvent to get the corrected y for.
Returns:
an integer representing the proper y coordinate.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Called if the mouse is released. Default is to tell the canvas that the receiver's work is through. Consume the event since we handle it.
Overrides:
mouseReleased in class AbstractInputEventHandler
Parameters:
e - the MouseEvent