ballworld.model.paint.strategy
Class SquarePaintStrategy

java.lang.Object
  extended by ballworld.model.paint.strategy.SquarePaintStrategy
All Implemented Interfaces:
IPaintStrategy

public class SquarePaintStrategy
extends java.lang.Object
implements IPaintStrategy

Paint strategy that paints a filled square with the Ball's radius. This functionality is duplicated by the RectanglePaintStrategy. The class demonstrates a direct implementation of IPaintStrategy.


Field Summary
 
Fields inherited from interface ballworld.model.IPaintStrategy
NullObject
 
Constructor Summary
SquarePaintStrategy()
          No parameter constructor for the class
 
Method Summary
 void init(Ball context)
          By default, do nothing for initialization.
 void paint(java.awt.Graphics g, Ball host)
          Paints a square on the given graphics context using the color and radius provided by the host.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SquarePaintStrategy

public SquarePaintStrategy()
No parameter constructor for the class

Method Detail

paint

public void paint(java.awt.Graphics g,
                  Ball host)
Paints a square on the given graphics context using the color and radius provided by the host. param g The Graphics context that will be paint on param host The host Ball that the required information will be pulled from.

Specified by:
paint in interface IPaintStrategy
Parameters:
g - The graphics context to draw upon.
host - The host ball.

init

public void init(Ball context)
By default, do nothing for initialization.

Specified by:
init in interface IPaintStrategy
Parameters:
context - The ball to initialize.