ballwar.model.paint
Class FixedColorDecoratorPaintStrategy
java.lang.Object
ballwar.model.paint.ADecoratorPaintStrategy
ballwar.model.paint.FixedColorDecoratorPaintStrategy
- All Implemented Interfaces:
- IPaintStrategy
public class FixedColorDecoratorPaintStrategy
- extends ADecoratorPaintStrategy
Decorator paint strategy that decorates another IPaintStrategy and
causes the painted color to always be a specified, fixed color.
Useful when you want a shape that is a specific color and not the
color of the host Ball, for example, the black colored eye
on a fish.
Note that this class only works in situations where paintXfrm is called,
because if paint is called, the call is delegated to the decoree,
which will then delegate to its own paintXfrm method, not this decorator's
method. Thus, this class is best used when being composed with
other paint strategies inside a MultiPaintStrategy.
Field Summary |
(package private) Color |
color
The color that will be painted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
color
Color color
- The color that will be painted.
FixedColorDecoratorPaintStrategy
public FixedColorDecoratorPaintStrategy(Color color,
IPaintStrategy decoree)
- Constructor that
paintXfrm
public void paintXfrm(Graphics g,
Ball host,
AffineTransform at)
- Description copied from class:
ADecoratorPaintStrategy
- Default behavior is to simply delegate to the decoree's paintXfrm method
- Specified by:
paintXfrm
in interface IPaintStrategy
- Overrides:
paintXfrm
in class ADecoratorPaintStrategy
- Parameters:
g
- The graphics context which is passed to the decoreehost
- The host Ball which is passed to the decoree.at
- The affine transform which is passed to the decoree.