public abstract class AbstractFigure extends java.lang.Object implements Figure
Modifier and Type | Field and Description |
---|---|
(package private) java.util.List<FigureChangeListener> |
listenerList
the listeners of this figure
|
Constructor and Description |
---|
AbstractFigure()
Base construction of a figure
|
Modifier and Type | Method and Description |
---|---|
void |
addFigureChangeListener(FigureChangeListener l)
Adds a listener for this figure.
|
protected abstract void |
basicMoveBy(int dx,
int dy)
This is the hook method to be overridden when a figure moves.
|
void |
changed()
Informs that a figure has changed its display box.
|
void |
invalidate()
Invalidates the figure.
|
void |
moveBy(int dx,
int dy)
Move the figure by a delta (dx, dy) offset from its present position.
|
void |
removeFigureChangeListener(FigureChangeListener l)
Removes a listener for this figure.
|
protected void |
willChange()
Informes that a figure is about to change something that affects the
contents of its display box.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
displayBox, draw
java.util.List<FigureChangeListener> listenerList
public void moveBy(int dx, int dy)
Figure
protected void willChange()
public void invalidate()
Figure
invalidate
in interface Figure
protected abstract void basicMoveBy(int dx, int dy)
dx
- the delta to move in x directiondy
- the delta to move in y directionpublic void changed()
Figure
public void addFigureChangeListener(FigureChangeListener l)
Figure
addFigureChangeListener
in interface Figure
l
- the listener to associate with this figurepublic void removeFigureChangeListener(FigureChangeListener l)
Figure
removeFigureChangeListener
in interface Figure
l
- the listener to remove this figureFrom the book: Flexible, Reliable Software, © CRC Press 2010. Author: Henrik B. Christensen, Aarhus University, Denmark