Class PuzzlePiece
java.lang.Object
|
+----PuzzlePiece
- public class PuzzlePiece
- extends Object
-
PuzzlePiece()
- Initialize the label to 0 and the corner to (0,0).
-
PuzzlePiece(int)
- Initialize the label to l and the corner to (0,0).
-
PuzzlePiece(int, double, double)
- Initialize the label to l and the corner to (x,y).
-
draw()
- Draw the puzzle piece.
-
move(int, int)
- Move the piece by dx units in the x direction and dy units in the y
direction.
PuzzlePiece
public PuzzlePiece()
- Initialize the label to 0 and the corner to (0,0).
PuzzlePiece
public PuzzlePiece(int l)
- Initialize the label to l and the corner to (0,0).
- Parameters:
- l - the label for the piece
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.
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
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.