Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

342 HOUR 23:Creating Java2D Graphics


Quiz



  1. Which one of the following is nota constant used to select a color?
    A. Color.cyan
    B. Color.teal
    C. Color.magenta

  2. When you change the color of something and redraw it on a container,
    what must you do to make it visible?
    A. Use the drawColor()method.
    B. Use the repaint()statement.
    C. Do nothing.

  3. What do the initials RGB stand for?
    A. Roy G. Biv
    B. Red Green Blue
    C. Lucy in the Sky with Diamonds


Answers



  1. B.The primary color of the Jacksonville Jaguars,teal,has gone unrepre-
    sented in Color.

  2. B.The call to repaint()causes the paintComponent()method to be
    called manually.

  3. B.If C. were the right answer,you could use colors that would only be
    visible years later during flashbacks.


Activities
To f u r t h e rexplore the spectrum of possibilities when using fonts and color in
your programs,do the following activities:

. Create a version of the PieFrameclass that takes color values and pie
slice values as command-line arguments instead of including them in
the source code of the application.
. Create an application that draws a stop sign on a panel using colors,
shapes,and fonts.


To s e e J av a p r o g r a m s t h a t i m p l e m e n t t h e s e a c t i v i t i e s ,visit the book’s website
at http://www.java24hours.com.
Free download pdf