Java Reference
In-Depth Information
Exercises
15-1. Modify
FirstApplet
to take advantage of the features of the
Graphics
class,
so that it displays the “Hello World” message in a more visually interesting
way.
15-2. Modify the
Clock
applet so that it is configurable via applet parameters.
Your modified applet should read parameters that specify the update fre-
quency for the time display, as well as the font, color, and format of the
time display. (See
java.text.SimpleDateFormat
for a way to format dates
and times according to a specified pattern). Also, add a
getParameterInfo()
method that describes the applet parameters you define and modify
getAp-
pletInfo()
to include a message describing your contribution to the applet.
15-3. Modify the
Soundmap
applet so that it responds to mouse-motion events as
well as mouse presses and releases. Your modified applet should highlight
whatever rectangle the mouse is over, even if the mouse button is not
pressed.
15-4. Write an applet that displays an arbitrary set of lines described through one
or more applet parameters. Test your applet by having it draw something
interesting. You may want to look at Example 13-2 for a way to encode a set
of line segments in a textual form suitable to use as an applet parameter.