February 2014
Beginner
1248 pages
62h 25m
English
6.1 Using method fillOval, draw a bull’s-eye that alternates between two random colors, as in Fig. 6.13. Use the constructor Color(int r, int g, int b) with random arguments to generate random colors.
Fig. 6.13 | A bulls-eye with two alternating, random colors.
6.2 Create a program that draws 10 random filled shapes in random colors, positions and sizes (Fig. 6.14). Method paintComponent should contain a loop that iterates 10 times. In each iteration, the loop should determine whether to draw a filled rectangle or an oval, create a random color and choose coordinates and dimensions at random. The coordinates ...
Read now
Unlock full access