Java Reference
In-Depth Information
The drawing panel is the same except that now each figure has a different size. The left figure has its original size of
100, the top-right figure has a size of 50, and the bottom-right figure has a size of 180. Use parameterized static
methods to reduce the redundancy of your solution.
8. Write a program that uses the DrawingPanel to draw the figure shown in Figure 3G.26.
Figure 3G.26
The window is 600
200 pixels in size. The background is yellow and the lines are blue. The lines are 10 pixels
apart vertically, and the diagonal lines intersect at the bottom of the figure in its horizontal center.
×
9. Write a program that uses the DrawingPanel to draw the spiral shown in Figure 3G.27.
Figure 3G.27
The window is 170
170 pixels. The background is white and the foreground is black. The spiral line begins at point
(0, 10) and spirals inward. There are 10 pixels between each arm of the spiral and eight spirals in all. The initial spi-
ral touches points (0, 10), (160, 10), (160, 160), (10, 160), and (10, 20).
For an additional challenge, parameterize your program with parameters such as the window size and the number
of spiral loops desired.
×
Search WWH ::




Custom Search