public class CarShape extends java.lang.Object implements MoveableShape
| Modifier and Type | Field and Description |
|---|---|
private int |
width |
private int |
x |
private int |
y |
| Constructor and Description |
|---|
CarShape(int x,
int y,
int width)
Constructs a car item.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(java.awt.Graphics2D g2)
Draws the shape.
|
void |
translate(int dx,
int dy)
Moves the shape by a given amount.
|
public CarShape(int x, int y, int width)
x - the left of the bounding rectangley - the top of the bounding rectanglewidth - the width of the bounding rectanglepublic void translate(int dx, int dy)
MoveableShapetranslate in interface MoveableShapedx - the amount to translate in x-directiondy - the amount to translate in y-directionpublic void draw(java.awt.Graphics2D g2)
MoveableShapedraw in interface MoveableShapeg2 - the graphics context