20.4. Applet Life-Cycle Methods

Now that you have created an applet, let’s consider the five applet methods that are called by the applet container from the time the applet is loaded into the browser to the time that it is terminated by the browser. These methods correspond to various aspects of an applet’s life cycle. Figure 20.9 lists these methods, which are inherited into your applet classes from class JApplet. The table specifies when each method gets called and explains its purpose. Other than method paint, these methods have empty bodies by default. If you would like to declare any of these methods in your applets and have the applet container call them, you must use the method headers shown in Fig. 20.9. If you modify the method headers ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.