Class Peg

java.lang.Object
  |
  +--Peg

class Peg
extends java.lang.Object

The Peg class is a blueprint for a Peg object.

Since:
JDK1.0
Author:
MarkF (008095880@00.humber.ac.uk). Based on Circle class in Chapter 38 of... Bradley Kjell's "Introduction to Computer Science using Java".
See Also:
Board

Field Summary
private  int color
           
private static java.awt.Color[] PALETTE
           
private  int radius
           
private  int x
           
private  int y
           
 
Constructor Summary
Peg()
           
Peg(int radius, int color)
           
 
Method Summary
 int getColor()
          Returns the color of the peg.
 void paint(java.awt.Graphics g)
           
 void setColor(int newC)
          Changes the color of the peg.
 void setPosition(int newX, int newY)
          Changes the center of the peg to a new X and Y.
 void setRadius(int newR)
          Changes the radius of the peg.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

color

private int color

x

private int x

y

private int y

radius

private int radius

PALETTE

private static final java.awt.Color[] PALETTE
Constructor Detail

Peg

public Peg()

Peg

public Peg(int radius,
           int color)
Method Detail

paint

public void paint(java.awt.Graphics g)

setPosition

public void setPosition(int newX,
                        int newY)
Changes the center of the peg to a new X and Y.

setRadius

public void setRadius(int newR)
Changes the radius of the peg.

setColor

public void setColor(int newC)
Changes the color of the peg.

getColor

public int getColor()
Returns the color of the peg.