O'Reilly logo

Java All-in-One For Dummies, 4th Edition by Doug Lowe

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

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 ...

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