Java Reference
In-Depth Information
If a browser is displaying the applet when a new page is viewed, the stop( ) method
is called, which sets stopFlag to true , causing run( ) to terminate. It also sets t to
null . Thus, there is no longer a reference to the Thread object, and it can be recycled
the next time the garbage collector runs. This is the mechanism used to stop the
thread when its page is no longer in view. When the applet is brought back into view,
start( ) is once again called, which starts a new thread to execute the banner. Inside
paint( ) , the message is rotated and then displayed.
6. The entire banner applet is shown here:
Search WWH ::




Custom Search