O'Reilly logo

Sams Teach Yourself Java™ in 24 Hours, Sixth Edition by Rogers Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an Applet

When the Java language was introduced, the language feature that got the most attention was applets, Java programs that run on web pages. You can run them in any web browser that handles Java programs and test them with appletviewer, a tool included in the JDK that’s supported in NetBeans.

The structure of applets differs from applications. Unlike applications, applets do not have a main() block. Instead, they have several sections that are handled depending on what is happening in the applet. Two sections are the init() block statement and the paint() block. init() is short for initialization, and it is used to take care of anything that needs to be set up as an applet first runs. The paint() block is used to display anything ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required