Class Square

java.lang.Object
  extended by Square

public class Square
extends java.lang.Object

This class holds is used with Board to maintain squares for a checker or chess board


Field Summary
protected  java.awt.Color color
           
protected  Piece contents
           
protected  java.awt.Point coord
           
protected  boolean hasChecker
           
protected  boolean isOccupiable
           
protected  java.awt.Point pos
           
protected  int width
           
 
Constructor Summary
Square(int x, int y, int w)
          This method constructs the square variables
 
Method Summary
 void drawSquare(java.awt.Graphics g)
          This method draws the squares on the board (JPanel) public
 int getCol()
          This method gets protected information from the square class.
 java.awt.Color getColor()
          This method gets protected information from the square class.
 boolean getHasChecker()
          This method gets protected information from the square class.
 boolean getIsOccupiable()
          This method gets protected information from the square class.
 int getRow()
          This method gets protected information from the square class.
 int getWidth()
          This method gets protected information from the square class.
 int getXpos()
          This method gets protected information from the square class.
 int getYpos()
          This method gets protected information from the square class.
 void setCol(int c)
          This method sets col.
 void setColor(java.awt.Color c)
          This method sets color.
 void setHasChecker(boolean has)
          This method sets hasChecker.
 void setIsOccupiable(boolean is)
          This method sets isOccupiable.
 void setRow(int r)
          This method sets row.
 void setWidth(int w)
          This method sets width.
 void setXpos(int x)
          This method sets xpos.
 void setYpos(int y)
          This method sets ypos.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pos

protected java.awt.Point pos

coord

protected java.awt.Point coord

width

protected int width

color

protected java.awt.Color color

isOccupiable

protected boolean isOccupiable

hasChecker

protected boolean hasChecker

contents

protected Piece contents
Constructor Detail

Square

public Square(int x,
              int y,
              int w)
This method constructs the square variables

Parameters:
x - x coordinate
y - y coordinate
w - width
Method Detail

getRow

public int getRow()
This method gets protected information from the square class. (row - the row in the 8 X 8 board)

Returns:
row as an integer

setRow

public void setRow(int r)
This method sets row.

Parameters:
r - setting the row value

getCol

public int getCol()
This method gets protected information from the square class. (col - the column in the 8 X 8 board)

Returns:
x coordinate as an integer

setCol

public void setCol(int c)
This method sets col.

Parameters:
c - setting the row value

getXpos

public int getXpos()
This method gets protected information from the square class. (xpos - the "x" postion of the square) public

Returns:
x position in pixels

setXpos

public void setXpos(int x)
This method sets xpos. public

Parameters:
x - position in pixels

getYpos

public int getYpos()
This method gets protected information from the square class. (ypos - the "y" position of the square) public

Returns:
y position in pixels

setYpos

public void setYpos(int y)
This method sets ypos. public

Parameters:
y - Setting the y position in pixels

getWidth

public int getWidth()
This method gets protected information from the square class. (width - the width of the square) public

Returns:
returnin the width

setWidth

public void setWidth(int w)
This method sets width. public

Parameters:
w - setting the width

getColor

public java.awt.Color getColor()
This method gets protected information from the square class. public (color - the color of the square)

Returns:
returning the color

setColor

public void setColor(java.awt.Color c)
This method sets color. public

Parameters:
c - setting the color

getIsOccupiable

public boolean getIsOccupiable()
This method gets protected information from the square class. (isOccupieable - can the square recieve a checker) public

Returns:
true if square is occupiable

setIsOccupiable

public void setIsOccupiable(boolean is)
This method sets isOccupiable. public

Parameters:
is - setting if the square is occupiable

getHasChecker

public boolean getHasChecker()
This method gets protected information from the square class. (hasChecker - does this square have a checker) public

Returns:
true if the square has a Checker

setHasChecker

public void setHasChecker(boolean has)
This method sets hasChecker. pubilc

Parameters:
has - setting the square to having a pawn or king

drawSquare

public void drawSquare(java.awt.Graphics g)
This method draws the squares on the board (JPanel) public

Parameters:
g - passed Graphics object to use in paint