CS 120
Fall 2016, Instructor: Jeffrey
Horn
Assignment
3: "Graphics"
Handed out:
Tuesday, September 6, 2016
Due: TBA
Purpose: Learn
- basics of Java graphics: Graphics
class, paint method, drawing commands
- creating and using randomness
- 24-bit color coordinate system
- for-next loops
- intro to event-driven programs (calling
paint)
Background Material:Graphics
comands from textbook (GUI Java):
here
Example Code:
Basic starting files: Two files needed (A3.java,
PanelApplication.java), or in one
zipped folder here.
Additional examples (in class, and also online notes here)
DETAILS:
-
Paint a landscape at sunset or sunrise (or thereabouts!). This
means a sky with a continuous gradation in brightness (from dark to light or
vice versa, vertically), above, with a surface (e.g, land, water) below.
-
Give a 3D effect using lines to indicate a highway, river, etc. converging
toward the horizon.
-
Fill the sky, or the ground, with hundreds of randomly located objects
(e.g., stars, snow flakes, raindrops, flowers, etc.). They can
be the same color, and the same size, but they should be sprinkled about!
(i.e., different locations)
-
Use a for-next loop (e.g., for the hundreds of random objects)
Send me .java source code file, to "jhorn@nmu.edu"
with SUBJECT line: "CS120 A3".
GRADING: TOTAL: 100 pts.
EXTRA CREDIT CHALLENGES:
- Use randomized colors in your randomized objects.
- Make your graduated
sky curved (e.g., successive ovals). Especially impressive if you can
do this without leaving "holes"! (i.e., uncolored pixels...)