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 thejava.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.
This section describes how to load your applet's data files, such as images.
This section describes how to make an applet display a string on the status line of the application in which it is running.
This section tells you how to use the two showDocument
methods to request that the browser visit a particular URL.
This section provides details and example applets that communicate with each other.
The AudioClip
interface provides support for playing sounds in applets, as explained and demonstrated in this section.
This section describes how to decide which parameters to provide, how to implement them, and how to inform the user about them.
This section tells you how to customize an applet by editing its HTML tag.