Applet Initialization and Termination

It is important to understand the order in which the various methods shown in the skeleton are executed. When an applet begins, the following methods are called in this sequence:

1. init( )

2. start( )

3. paint( )

When an applet is terminated, the following sequence of method calls takes place:

1. stop( )

2. destroy( )

Let’s look more closely at these methods.

The init( ) method is the first method to be called. In init( ) your applet will initialize variables and perform any other startup activities.

The start( ) method is called after init( ). It is also called to restart an applet after it has been stopped, such as when the user returns to a previously displayed Web page that contains an applet. Thus, ...

Get Java, A Beginner's Guide, 5th Edition, 5th 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.