Home Segments Top Top Previous Next

799: Sidetrip

When a browser loads an applet, it calls not only the constructor, but also the init method, which contains computations to be performed once the applet is loaded. The inherited init does nothing.

A browser also calls the start method each time that the page containing an applet is visited or revisited. The start method is meant to contain computations to be performed to start the applet. For example, if an applet involves animation, the start method would start the animation.

On the other end, a browser calls the stop method each time that the page containing an applet is replaced by another page. A browser also calls the stop method just before calling the destroy method. For example, if an applet involves animation, the stop method would stop the animation.

Finally, a browser calls the destroy method each time that the page containing an applet is abandoned completely. The destroy method contains computations to be performed to exit from the applet application. The destroy method is called, for example, when the browser shuts down, or, in some browsers, when the page containing an applet is replaced by another page.