An Applet Overview

An applet is a special type of Java GUI program that is intended to be run inside a Web browser. Unlike the programs shown in Chapter 8, "GUI Programming I: Applications," an applet cannot run by itself but must be hosted by another program.

Note

You can code an applet class that can run in a standalone fashion as an application and as an applet hosted by a browser. This is unusual but can easily be accomplished. To do this, you code all the applet methods that are appropriate. Then you code a main method that one way or another instantiates a Frame, instantiates the applet subclass, adds the applet object to the Frame, and then calls the applet methods as appropriate. Because the applet is running as a standalone application, ...

Get PURE Java™ 2 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.