L20_pkg
Class PolkaDot

java.lang.Object
  extended by L20_pkg.PolkaDot

public class PolkaDot
extends java.lang.Object

This class encapsulates a polka dot shape, which has a diameter, a color, and a position.

Author:
mb

Constructor Summary
PolkaDot(int xPos, int yPos, java.awt.Color col, int diameter)
          Construct a polka dot with the specified attributes.
PolkaDot(java.awt.Point point, java.awt.Color col, int diameter)
          Construct a polka dot with the specified attributes.
 
Method Summary
 void drawComponent(java.awt.Graphics2D graphics2D)
          This method causes this polka dot to be drawn on the passed Graphics2D objects.
static PolkaDot getRandom(int xDim, int yDim)
          This method generates a random polka dot, with a color randomly chosen among RGB and a position chosen randomly from within a palette of 6 basic colors (red, orange, yellow, green, blue, magenta).
 java.awt.Color getTheColor()
          Get the color of this Polka Dot
 void setTheColor(java.awt.Color theColor)
          Specify the color of this Polka Dot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolkaDot

public PolkaDot(int xPos,
                int yPos,
                java.awt.Color col,
                int diameter)
Construct a polka dot with the specified attributes.

Parameters:
xPos -
yPos -
col -
diameter -

PolkaDot

public PolkaDot(java.awt.Point point,
                java.awt.Color col,
                int diameter)
Construct a polka dot with the specified attributes.

Parameters:
point -
col -
diameter -
Method Detail

setTheColor

public void setTheColor(java.awt.Color theColor)
Specify the color of this Polka Dot

Parameters:
theColor -

getTheColor

public java.awt.Color getTheColor()
Get the color of this Polka Dot


drawComponent

public void drawComponent(java.awt.Graphics2D graphics2D)
This method causes this polka dot to be drawn on the passed Graphics2D objects.

Parameters:
graphics2D -

getRandom

public static PolkaDot getRandom(int xDim,
                                 int yDim)
This method generates a random polka dot, with a color randomly chosen among RGB and a position chosen randomly from within a palette of 6 basic colors (red, orange, yellow, green, blue, magenta). The diameter is chosen randomly from the interval [20,50]

Returns: