|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractInputEventHandler
|
+--com.rolemodelsoft.drawlet.basics.CanvasHandle
This abstract class offers a simple base for handles to be used on a canvas. Subclasses need to provide, at a minimum, implementations for:
| Field Summary | |
protected DrawingCanvas |
canvas
The canvas upon which to "operate" |
protected static int |
halfWidth
Half the general width of handles. |
protected static int |
HANDLE_SIZE
The general size of handles (assuming same size in x and y direction). |
protected InputEventHandler |
previousTool
The tool that was in control before this one took over. |
| Constructor Summary | |
CanvasHandle()
|
|
| Method Summary | |
boolean |
contains(int x,
int y)
Checks whether a specified x,y location is "inside" this handle. |
static int |
defaultHandleSize()
Answers the default value of HANDLE_SIZE; |
protected void |
finished()
The handle has completed its task... |
abstract java.awt.Rectangle |
getBounds()
Returns the current bounds of this handle. |
protected int |
getHandleHeight()
Answers the height of the handle; |
static int |
getHandleSize()
Answer the value of HANDLE_SIZE. |
protected int |
getHandleWidth()
Answers the width of the handle; |
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. |
boolean |
intersects(java.awt.Rectangle box)
Answers whether the receiver intersects a Rectangular area. |
void |
mouseReleased(java.awt.event.MouseEvent e)
By default, we are finished with our task when the mouse goes up, so we clean up. |
void |
paint(java.awt.Graphics g)
Paints the handle. |
void |
releaseControl(DrawingCanvas canvas)
Release control of the canvas and clean up if necessary. |
static void |
setHandleSize(int size)
Set the value of HANDLE_SIZE. |
void |
takeControl(DrawingCanvas canvas)
Make the handle be the event handler for the canvas. |
| 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 |
protected static int HANDLE_SIZE
protected static int halfWidth
protected DrawingCanvas canvas
protected InputEventHandler previousTool
| Constructor Detail |
public CanvasHandle()
| Method Detail |
public boolean contains(int x,
int y)
x - the x coordinatey - the y coordinatetrue if the specified x,y
location is "inside" this handle;
false otherwise.public static int defaultHandleSize()
protected void finished()
public abstract java.awt.Rectangle getBounds()
protected int getHandleHeight()
public static int getHandleSize()
protected int getHandleWidth()
protected int getX(java.awt.event.MouseEvent evt)
evt - the MouseEvent to get the corrected x for.protected int getY(java.awt.event.MouseEvent evt)
evt - the MouseEvent to get the corrected y for.public boolean intersects(java.awt.Rectangle box)
box - the Rectangular areatrue if the receiver intersects
the specified Rectangular area;
false otherwise.public void mouseReleased(java.awt.event.MouseEvent e)
e - the eventpublic void paint(java.awt.Graphics g)
g - the specified Graphics windowpublic void releaseControl(DrawingCanvas canvas)
canvas - the canvas which the receiver is to release controlpublic static void setHandleSize(int size)
size - the new size of handles.public void takeControl(DrawingCanvas canvas)
canvas - the canvas to be the event handler for#locate
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||