Chapter 1

Creating Applets

In This Chapter

arrow Looking at applets

arrow Creating an applet

arrow Creating HTML to display applets

arrow Testing applets with the applet viewer

An applet is not a small piece of fruit. Rather, it's a Java application that's designed to run in a browser window on an Internet user's computer. When an Internet user visits a web page that contains an applet, the Java applet class is downloaded to the user's computer and run there. The applet takes over a portion of the page and, within that space, can do anything it wants.

Applets are Swing applications — at least, in most cases. As a result, everything that's covered in Book VI applies to applets.

In this chapter, you create applets that include Swing components. Then you add an applet to a web page so that anyone who views the page can use it.

Understanding Applets

An applet is similar to a Swing application, with several crucial differences:

  • Instead of extending the JFrame class, applets extend the JApplet class. Both JFrame and JApplet provide a space for your Swing application to operate in:
    • With JFrame, that space is ...

Get Java All-in-One For Dummies, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.