Create a Swing Applet
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:
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access