com.rolemodelsoft.drawlet
Interface Handle

All Known Implementing Classes:
CanvasHandle

public interface Handle
extends InputEventHandler

This interface defines protocols for Handles which are event handlers that may visibly appear on a DrawingCanvas.


Method Summary
 boolean contains(int x, int y)
          Checks whether a specified x,y location is "inside" this handle, where x and y are defined to be relative to the coordinate system of this handle.
 java.awt.Rectangle getBounds()
          Returns the current bounds of this handle.
 boolean intersects(java.awt.Rectangle box)
          Answers whether the receiver intersects a Rectangular area.
 void paint(java.awt.Graphics g)
          Paints the handle.
 void releaseControl(DrawingCanvas canvas)
          Release control of the canvas and clean up if necessary.
 void takeControl(DrawingCanvas canvas)
          Make the handle be the event handler for the canvas.
 
Methods inherited from interface java.awt.event.KeyListener
keyPressed, keyReleased, keyTyped
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
 
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
 

Method Detail

contains

public boolean contains(int x,
                        int y)
Checks whether a specified x,y location is "inside" this handle, where x and y are defined to be relative to the coordinate system of this handle.
Parameters:
x - the x coordinate
y - the y coordinate
Returns:
boolean value of true if the specified x,y location is "inside" this handle; false otherwise.

getBounds

public java.awt.Rectangle getBounds()
Returns the current bounds of this handle.
Returns:
a Rectangle representing the current bounds of this handle

intersects

public boolean intersects(java.awt.Rectangle box)
Answers whether the receiver intersects a Rectangular area.
Parameters:
box - the Rectangular area
Returns:
boolean value of true if the receiver intersects the rectangular area; false otherwise.

paint

public void paint(java.awt.Graphics g)
Paints the handle.
Parameters:
g - the specified Graphics window

releaseControl

public void releaseControl(DrawingCanvas canvas)
Release control of the canvas and clean up if necessary. Since this is a public method, don't assume the receiver actually has control.
Parameters:
canvas - the canvas which the receiver is to release control

takeControl

public void takeControl(DrawingCanvas canvas)
Make the handle be the event handler for the canvas. Note, once it takes control, it is obligated to return at a future point in time.
Parameters:
canvas - the canvas which the receiver is to control