Chapter 1
Creating Applets
In This Chapter
Looking at applets
Creating an applet
Creating HTML to display applets
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access