go to previous page   go to home page   go to next page

Answer:

Of course.


Blizzard

Many Snowflakes

The paintComponent method can be modified to draw several dozen snowflakes of random colors at random locations:

A counting loop controls how many flakes are drawn. Construct a new Random object and use its nextInt() method. The location and size of each flake is determined by:

x    = rand.nextInt( width  ); 
y    = rand.nextInt( height ); 
size = rand.nextInt( 20 );  

QUESTION 15:

How many different colors are there in this picture?