Java Reference
In-Depth Information
Chapter 15 Self Test
when an applet is removed from the system?
3
.
Enhance
Try This 15-1
so that it displays the string passed to it as a parameter. Add a
second parameter that specifies the time delay (in milliseconds) between each rota-
tion.
second. To accomplish this, you will need to do a little research. Here is a hint to
help you get started: One way to obtain the current time is to use a
Calendar
object,
which is part of the
java.util
package. (Remember, Oracle provides online docu-
mentation for all of Java's standard classes.) You should now be at the point where
you can examine the
Calendar
class on your own and use its methods to solve this
problem.
the currently selected color between two points. It is part of the
Graphics
class.
Using
drawLine( )
, write a program that tracks mouse movement. If the button is
pressed, have the program draw a continuous line until the mouse button is released.
10.
Extra challenge: Try adding support for
MouseWheelEvent
to the
MouseEvents
ap-
plet shown in the section “Using the Delegation Event Model.” To do this, imple-
ment the
MouseWheelListener
interface and add the applet as listener for this event
by using
addMouseWheelListener( )
. You will need to use Java's API documenta-
tion to find the details about these items. No answer is given for this question. You
must use your skills to provide your own solution.