<< Chapter < Page | Chapter >> Page > |
Revised: Mon Apr 04 10:05:32 CDT 2016
This page is included in the following Books:
This module is one of a series of modules designed to teach you about Object-Oriented Programming (OOP) using Java.
The program described in this module requires the use of the Guzdial-Ericson multimedia class library. You will find download, installation, and usageinstructions for the library at Java OOP: The Guzdial-Ericson Multimedia Class Library .
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the Figures and Listings while you are reading about them.
In this module you will learn to use the GradientPaint class along with a variety of other Java2D classes.
Program specifications
Write a program named Prob03 that uses the class definition shown in Listing 1 and Ericson's media library along with the image file named Prob03.jpg to produce the graphic output image shown in Figure 1 . (Note that the image in the file named Prob03.jpg is a blank white image. You could also create thisblank image using one of the constructors for the Picture class.)
Figure 1 - Required graphic output.
Circles with gradient paint
The program draws four circles in the quadrants of a Cartesian coordinate system. One is filled with solid green. The other three are filled with cyclicgradient paint from green to blue.
The number of cycles varies in each circle, as do the axes along which the gradient occurs.
The background is set to Color.RED.
New classes
You may define new classes as necessary to cause your program to behave as required, but you may not modify the class definition for the class named Prob03 shown in Listing 1 .
Required text output
In addition to the output image mentioned above, your program must display your name and the other line of text shown in Figure 2 .
Figure 2 - Required text output. |
---|
Display your name here.
Picture, filename Prob03.jpg height 300 width 300 |
Will discuss in fragments
I will discuss and explain this program in fragments. A complete listing of the program is provided in Listing 9 near the end of the module.
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?