com.rolemodelsoft.drawlet.basics
Class SquareCanvasHandle
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractInputEventHandler
|
+--com.rolemodelsoft.drawlet.basics.CanvasHandle
|
+--com.rolemodelsoft.drawlet.basics.SquareCanvasHandle
- Direct Known Subclasses:
- BoundsHandle, ConnectedLineCreationHandle, LinePointHandle, PolygonPointHandle
- public abstract class SquareCanvasHandle
- extends CanvasHandle
Since many handles will be simple small squares (probably appearing on a
DrawingCanvas), this abstract class offers a simple base for handles which
appear this way.
All subclasses need to provide, at a minimum, are the coordinates for the center
of the square via:
centerX()
centerY()
|
Method Summary |
protected abstract int |
centerX()
Answer the x coordinate at the center of the handle. |
protected abstract int |
centerY()
Answer the y coordinate at the center of the handle. |
java.awt.Rectangle |
getBounds()
Returns the current bounds of this handle. |
void |
paint(java.awt.Graphics g)
Paints the handle. |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.CanvasHandle |
contains,
defaultHandleSize,
finished,
getHandleHeight,
getHandleSize,
getHandleWidth,
getX,
getY,
intersects,
mouseReleased,
releaseControl,
setHandleSize,
takeControl |
| 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 |
SquareCanvasHandle
public SquareCanvasHandle()
centerX
protected abstract int centerX()
- Answer the x coordinate at the center of the handle.
- Returns:
- an integer representing the x coordinate in the center of the
handle
centerY
protected abstract int centerY()
- Answer the y coordinate at the center of the handle.
- Returns:
- an integer representing the y coordinate in the center of the
handle
getBounds
public java.awt.Rectangle getBounds()
- Returns the current bounds of this handle.
- Overrides:
- getBounds in class CanvasHandle
- Returns:
- a Rectangle representing the current bounds of this handle
paint
public void paint(java.awt.Graphics g)
- Paints the handle.
- Overrides:
- paint in class CanvasHandle
- Parameters:
g - the specified Graphics window