|
What does this do:
A good answer might be:It sets the background of the screen area to be painted to pink. (Some browsers will not change the color, depending on how your computer has been set up.) | |
Graphics Objects
The background color of the applet is the color of the drawing area. It can be set to a pre-defined color or to a custom color. This will be discussed further in a few pages. In order to connect your applet to the particular area of the screen to be painted, the web browser must pass your paint method a reference to a Graphics object. You can think of this object as representing the part of the screen your applet is painting. Since it is an object, it comes complete with many methods for doing graphical things. The Graphics object is somewhat like a "paint" program (such as in Microsoft operating systems) that has methods to draw lines, draw circles, write text, and so on. The statement:
calls the method drawString of the Graphics object referred
to by the variable gr.
It prints a String at the location given by the last two parameters:
Distance is measured in pixels. A pixel is one of the small dots that makes up a digital image. The actual size of the dot depends on the size of the monitor and the setting of the video card. For example, the following says to start the String 25 pixels down from the top edge, and 30 pixels from the left edge.
| |
QUESTION 4:The next line of the poem is:
Suggest a location for this String
(assume that characters are at most 10 pixels high.)
Click Here after you have answered the question
|