The preceding example programs have been Swing-based applications. The second type of program that commonly uses Swing is the applet. Swing-based applets are similar to AWT-based applets described in Chapter 14, but with an important difference: A Swing applet extends JApplet rather than Applet. JApplet is derived from Applet. Thus, JApplet includes all of the functionality found in Applet and adds support for Swing. JApplet is a top-level Swing container. Therefore, it includes the various panes described earlier. As a result, all components are added to JApplet’s content pane in the same way that components are added to JFrame’s content pane.
Swing applets use the same four lifecycle methods described in Chapter 14: