Java Reference
In-Depth Information
thousands of pixels, a realistic black and white photo can be produced
on a computer screen.
SR 2.39
The coordinates of the fourth corner are (3, 7), which is the top right
corner.
SR 2.40
We can tell from the given information that the side of the square has
length 3. Therefore, the other two corners are (5, 13) and (8, 13).
SR 2.41
Eight bits per number, three numbers per pixel, and 300 by 200 pixels
gives
8
3
300
200
1,440,000 bits
2.8 Applets
SR 2.42
A Java applet is a Java program that can be executed using a Web
browser. Usually, the bytecode form of the Java applet is pulled across
the Internet from another computer and executed locally. A Java appli-
cation is a Java program that can stand on its own. It does not require
a Web browser in order to execute.
SR 2.43
An applet's paint method is invoked by the system whenever the
applet's graphic element needs to be displayed (or “painted”) on the
screen. Examples include when the applet first runs or when a window
that was covering the applet's window is removed.
SR 2.44
The code tag should indicate a bytecode file, such as DrawHouse.class ,
and not a source code file. The file indicated by the tag is supposed to
be “ready to run” on a Java interpreter.
2.9 Drawing Shapes
SR 2.45 A bounding rectangle is an imaginary rectangle that surrounds a curved
shape, such as an oval, in order to define the shape's width, height, and
upper left corner.
SR 2.46 page.drawRect (16, 12, 50, 50);
SR 2.47
page.setColor (Color.blue);
page.fillRect (30, 35, 40, 20);
SR 2.48
The results of the changes are
a. Since the value of MID is added to all the horizontal components of
the snowman figure, the snowman shifts a little bit to the left.
b. Since the value of TOP is added to all the vertical components of
the snowman figure, the snowman shifts upwards a little bit.
c. The hat is now blue.
Search WWH ::




Custom Search