Starting Graphics Drawings

posted by: Mr. Bergquist 9 October 2012 No Comment

Worth 10 Classroom Points. These practice problems are designed to get you working with basic graphics. I want to see what you can figure out to make using Drawing Panel in a few days. Feel free to skip around and experiment BUT you MUST have at least a face with details plus a second imageImpress me with how intricate of a drawing you can make!

You will write a program to produce an image like the following figure:

This DrawingPanel has size 300 x 250 and has a yellow background. You should put each image in a separate method. To have multiple methods draw to the same DrawingPanel object, pass the Graphics object to each of them. That way, they will use the same pen to draw.

  1. Draw a bear face. The face and ears are orange. The face starts at 50, 50 and is a circle with a diameter of 50. The ears have a diameter of 20 and start at (45, 50) and (85, 50). The eyes are black circles with a diameter of 5. They are each 10 pixels in from the edge of the face’s bounding rectangle. The mouth is a rectangle of size 10 x 3 starting at (70, 85).
  2. Draw squares using a for loop. The smallest square has size 20 x 20. Each of the next squares is 20 pixels bigger than the last. The diagonal line starts at (150, 50).
  3. Draw a target. The largest circle is red and starts at (20, 120). Each subsequent circle is 10 pixels smaller in diameter. Colors alternate between red and white.
1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.20 out of 5)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>