public abstract class AbstractTool extends java.lang.Object implements Tool
Modifier and Type | Field and Description |
---|---|
protected DrawingEditor |
editor |
protected int |
fAnchorX |
protected int |
fAnchorY |
Constructor and Description |
---|
AbstractTool(DrawingEditor editor)
Abstract base class for all tools.
|
Modifier and Type | Method and Description |
---|---|
DrawingEditor |
editor() |
void |
keyDown(java.awt.event.KeyEvent evt,
int key)
Handles key down events in the drawing view (KEY_PRESSED events).
|
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 (while mouse button is down).
|
void |
mouseMove(java.awt.event.MouseEvent evt,
int x,
int y)
Handles mouse moves (while the mouse button is up).
|
void |
mouseUp(java.awt.event.MouseEvent e,
int x,
int y)
Handles mouse up in the drawing view.
|
protected DrawingEditor editor
protected int fAnchorX
protected int fAnchorY
public AbstractTool(DrawingEditor editor)
editor
- the editor (object server) that this tool is associated with.public void mouseDown(java.awt.event.MouseEvent e, int x, int y)
Tool
public void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
Tool
public void mouseUp(java.awt.event.MouseEvent e, int x, int y)
Tool
public void mouseMove(java.awt.event.MouseEvent evt, int x, int y)
Tool
public void keyDown(java.awt.event.KeyEvent evt, int key)
Tool
public DrawingEditor editor()
From the book: Flexible, Reliable Software, © CRC Press 2010. Author: Henrik B. Christensen, Aarhus University, Denmark