Part A. Change the move
method of the Bug2
class
from Homework 4 Part A so that the bug draws a trace of where it moves. The
move
method will receive a parameter of type
Graphics2D
so that you can do the drawing. Draw a line from the
old to the new position.
However, there is a complexity.
Therefore, you should transform the bug coordinates to drawing coordinates.
The transformation is
xgraphics = x * 20 + 200
ygraphics = -y * 20 + 200
Draft: Just draw the line without coordinate transformations.
Make sure that Bug2
has appropriate Javadoc comments.
Part B. Write a class VerticalStripedFlag
that generalizes the
ItalianFlag
of How To 3.2 in your textbook. In the constructor,
pass colors for the left, middle, and right. Change the drawing strategy so
that you fill three rectangles, one each of the given color, and then draw a
large rectangle around all three.
Draft: Don't yet implement the VerticalStripedFlag
class but
provide a VerticalStripedFlagComponent
class that draws two flags:
French and Belgian.
Final: Both VerticalStripedFlag
and
VerticalStripedFlagComponent
.
Part C. P4.10 from your textbook.
Draft: Stubs and javadoc for Balloon
; no tester