All Packages Class Hierarchy This Package Previous Next Index
Class prisoner.shapes.ShapeDrawer
java.lang.Object
|
+----prisoner.shapes.ShapeDrawer
- public abstract class ShapeDrawer
- extends java.lang.Object
This superclass and its subclasses are closely linked to the interfaces
GameBoard and Pawn. A GameBoard is an abstract concept of an array holding
Pawns in a certain structural relationship. A class implementing a GameBoard
will also have a physical representation. This has an implication on the shape
of the Pawns. The implementation of the GameBoard will tell the Pawns what shape it
expects them to take. In response the Pawns (or rather the implementations of the
Pawn interface) will choose one of the subclasses of ShapeDrawer.
The usefulness of the abstract superclass ShapeDrawer is two-fold:
- it ensure that all subclasses follow the same structure for the call to
drawShape() (this means that ideally this method should
not be overloaded;
- polymorphism: whatever shape the Pawn requires, the object can be cast as a ShapeDrawer,
so there's no need to keep track of the exact shape once the object has
been insantiated.
- Version:
- 1.00, 22 August 2001
- Author:
- Françcois Suter
- See Also:
- com.monpetitcoin.java.GameBoard, com.monpetitcoin.java.Pawn
-
ShapeDrawer()
-
-
drawShape(Graphics, Rectangle, Color)
-
ShapeDrawer
public ShapeDrawer()
drawShape
public void drawShape(java.awt.Graphics g,
java.awt.Rectangle bounds,
java.awt.Color foregroundColor)
- Parameters:
- g - the graphics context
- bounds - information about the size and position of the shape. It needs not be interpreted strictly as a bounding rectangle.
- foregroundColor - the foreground color for filling the shape.
All Packages Class Hierarchy This Package Previous Next Index