Standard Applet Methods

The first step in the creation of an applet is to make it a subclass of JApplet, a class that's part of the Swing package, javax.swing. An applet is treated as a visual window inside a web page, so JApplet is part of Swing alongside clickable buttons, scrollbars, and other components of a program's user interface.

JApplet is a subclass of Applet, a class in the java.applet package. Being part of this hierarchy enables the applets you write to use all the behavior and attributes they need to be run as part of a web page. Before you begin writing any other statements in your applets, they will be able to interact with a web browser, load and unload themselves, redraw their window in response to changes in the browser window, ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH 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.