Standard Applet Methods

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

The applets you write inherit 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 are able to interact with a web browser, load and unload themselves, redraw their windows in response to changes in the browser window, and handle other necessary tasks.

Applications begin running with the first statement inside the main() block. There is no main() ...

Get Sams Teach Yourself Java™ in 24 Hours, Sixth 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.