Java Reference
In-Depth Information
Notice that
Banner
extends
Applet
, as expected, but it also implements
Runnable
.
This is necessary since the applet will be creating a second thread of execution that
will be used to scroll the banner. The message that will be scrolled in the banner is
contained in the
String
variable
msg
. A reference to the thread that runs the applet is
stored in
t
. The Boolean variable
stopFlag
is used to stop the applet. Inside
init( )
,
the thread reference variable
t
is set to
null
.
3.
Add the
start( )
method shown next: