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

Answer:

What RGB values correspond to Color.WHITE ?

Color myWhite = new Color( 1.0, 1.0, 1.0, 1.0 );

What RGB values correspond to Color.BLACK ?

Color myWhite = new Color( 0.0, 0.0, 0.0, 1.0 );

brighter() and darker()

The sequence

Color myBlue  = new Color( 0.1, 0.3, 0.8, 0.85 );  // create a custom Color object
Color myLightBlue = myBlue.brighter();   // create a new Color object, based on the first

first creates a Color object using a constructor. The reference variable myBlue points to it. Then myBlue.brighter() creates a new color object with higher values for red, green, and blue. Note that the first color (pointed to by myBlue) does not change. This

Color  myDarkBlue = myBlue.darker();   // create a new Color object, based on the first

creates a second new Color object, darker than the first (less of red, green, and blue).


QUESTION 12:

Will either of these methods construct a Color with values out of range?


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