Class PuzzlePiece

java.lang.Object
   |
   +----PuzzlePiece

public class PuzzlePiece
extends Object

Constructor Index

 o PuzzlePiece()
Initialize the label to 0 and the corner to (0,0).
 o PuzzlePiece(int)
Initialize the label to l and the corner to (0,0).
 o PuzzlePiece(int, double, double)
Initialize the label to l and the corner to (x,y).

Method Index

 o draw()
Draw the puzzle piece.
 o move(int, int)
Move the piece by dx units in the x direction and dy units in the y direction.

Constructors

 o PuzzlePiece
 public PuzzlePiece()
Initialize the label to 0 and the corner to (0,0).

 o PuzzlePiece
 public PuzzlePiece(int l)
Initialize the label to l and the corner to (0,0).

Parameters:
l - the label for the piece
 o PuzzlePiece
 public PuzzlePiece(int l,
                    double x,
                    double y)
Initialize the label to l and the corner to (x,y).

Parameters:
l - the label for the piece
x - the x-coordinate of the corner.
y - the y-coordinate of the corner.

Methods

 o move
 public void move(int dx,
                  int dy)
Move the piece by dx units in the x direction and dy units in the y direction.

Parameters:
dx - change in x-coordinate
dy - change in y-coordinate
 o draw
 public void draw()
Draw the puzzle piece. The label is drawn, surrounded by a square whose upper left corner is the point stored in PuzzlePiece.