|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.standard.AbstractTool
public abstract class AbstractTool
Default implementation support for Tools.
DrawingView
,
Tool
Nested Class Summary | |
---|---|
static class |
AbstractTool.EventDispatcher
|
Constructor Summary | |
---|---|
AbstractTool(DrawingEditor newDrawingEditor)
Constructs a tool for the given view. |
Method Summary | |
---|---|
void |
activate()
Activates the tool for use on the given view. |
void |
addToolListener(ToolListener newToolListener)
|
void |
deactivate()
Deactivates the tool. |
Drawing |
drawing()
Gets the tool's drawing. |
DrawingEditor |
editor()
Gets the tool's editor. |
Drawing |
getActiveDrawing()
|
DrawingView |
getActiveView()
|
Undoable |
getUndoActivity()
|
boolean |
isActive()
An active tool is the currently selected tool in the DrawingView. |
boolean |
isEnabled()
A tool must be enabled in order to use it and to activate/deactivate it. |
boolean |
isUsable()
Tests if the tool can be used or "executed." |
void |
keyDown(java.awt.event.KeyEvent evt,
int key)
Handles key down events in the drawing view. |
void |
mouseDown(java.awt.event.MouseEvent e,
int x,
int y)
Handles mouse down events in the drawing view. |
void |
mouseDrag(java.awt.event.MouseEvent e,
int x,
int y)
Handles mouse drag events in the drawing view. |
void |
mouseMove(java.awt.event.MouseEvent evt,
int x,
int y)
Handles mouse moves (if the mouse button is up). |
void |
mouseUp(java.awt.event.MouseEvent e,
int x,
int y)
Handles mouse up in the drawing view. |
void |
removeToolListener(ToolListener oldToolListener)
|
void |
setEnabled(boolean newIsEnabled)
|
void |
setUndoActivity(Undoable newUndoActivity)
|
void |
setUsable(boolean newIsUsable)
|
DrawingView |
view()
Gets the tool's view (convienence method). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTool(DrawingEditor newDrawingEditor)
Method Detail |
---|
public void activate()
activate
in interface Tool
public void deactivate()
deactivate
in interface Tool
public void mouseDown(java.awt.event.MouseEvent e, int x, int y)
mouseDown
in interface Tool
public void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
mouseDrag
in interface Tool
public void mouseUp(java.awt.event.MouseEvent e, int x, int y)
mouseUp
in interface Tool
public void mouseMove(java.awt.event.MouseEvent evt, int x, int y)
mouseMove
in interface Tool
public void keyDown(java.awt.event.KeyEvent evt, int key)
keyDown
in interface Tool
public Drawing drawing()
public Drawing getActiveDrawing()
public DrawingEditor editor()
editor
in interface Tool
public DrawingView view()
public DrawingView getActiveView()
public boolean isUsable()
isUsable
in interface Tool
Tool.isEnabled()
,
Tool.isUsable()
public void setUsable(boolean newIsUsable)
setUsable
in interface Tool
public void setEnabled(boolean newIsEnabled)
setEnabled
in interface Tool
public boolean isEnabled()
Tool
isEnabled
in interface Tool
Tool.isUsable()
,
Tool.isActive()
public Undoable getUndoActivity()
getUndoActivity
in interface Tool
public void setUndoActivity(Undoable newUndoActivity)
setUndoActivity
in interface Tool
public boolean isActive()
Tool
isActive
in interface Tool
Tool.isEnabled()
,
Tool.isUsable()
public void addToolListener(ToolListener newToolListener)
addToolListener
in interface Tool
public void removeToolListener(ToolListener oldToolListener)
removeToolListener
in interface Tool
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |