Download the JDK
Search the Tutorials
Hide the TOC
Trail: Deployment
Lesson: Applets
Applets
Getting Started with Applets
Importing Classes and Packages for Applets
Defining an Applet Subclass
The Life Cycle of an Applet
Methods for Milestones
Methods for Drawing and Event Handling
Methods for Adding UI Components
What Applets Can and Can't Do
Taking Advantage of the Applet API
Finding and Loading Data Files
Displaying Short Status Strings
Displaying Documents in the Browser
Sending Messages to Other Applets
Playing Sounds
Defining and Using Applet Parameters
Deciding Which Parameters to Support
Writing the Code to Support Parameters
Giving Information about Parameters
Using the APPLET Tag
Practical Considerations When Writing Applets
Security Restrictions
Creating a User Interface
Creating a GUI
Displaying Diagnostics to the Standard Output and Error Streams
Getting System Properties
Threads in Applets
Threads in Applets: Examples
Working with a Server-Side Application
A Simple Network Client Applet
Using a Server to Work Around Security Restrictions
Finishing an Applet
Before You Ship that Applet
The Perfectly Finished Applet
Deploying Applets
General Deployment Considerations
Using the applet Tag
Using the object Tag
Using the embed Tag
Deploying Applets in a Mixed-Browser Environment
Solving Common Applet Problems
Questions and Exercises
Home Page > Deployment > Applets
Taking Advantage of the Applet API

> The applet API lets you take advantage of the close relationship that applets have with Web browsers. The API is provided by the `javax.swing.JApplet` class and the `java.applet.AppletContext` interface.

> Applets can use these APIs to do the following:

> - Be notified by the browser of milestones.
> - Load data files specified relative to the URL of the applet or the page in which it is running.
> - Display short status strings.
> - Make the browser display a document.
> - Find other applets running in the same page.
> - Play sounds.
> - Get parameters specified by the user in the `<APPLET>` tag.

> This section discusses each of these topics in turn, except for the milestone methods (`init`, `start`, and so on), which are explained in the Methods for Milestones section. For information about how to use non-applet-specific APIs in an applet, see the Practical Considerations When Writing Applets section.

### Finding and Loading Data Files

> This section describes how to load your applet's data files, such as images.

### Displaying Short Status Strings

> This section describes how to make an applet display a string on the status line of the application in which it is running.

### Displaying Documents in the Browser

> This section tells you how to use the two `showDocument` methods to request that the browser visit a particular URL.

### Sending Messages to Other Applets

> This section provides details and example applets that communicate with each other.

### Playing Sounds

> The `AudioClip` interface provides support for playing sounds in applets, as explained and demonstrated in this section.

### Defining and Using Applet Parameters

> This section describes how to decide which parameters to provide, how to implement them, and how to inform the user about them.

### Using the APPLET Tag

> This section tells you how to customize an applet by editing its HTML tag.

Previous page: What Applets Can and Can't Do
Next page: Finding and Loading Data Files