| Understanding Applet Capabilities and Restrictions

## Applet Capabilities

> The previous page might have made you feel like applets are merely crippled applications. Not true! Besides the obvious feature that applets can be loaded over the network, applets have more capabilities than you might think. They have access to the API in every `java.*` package (subject to security restrictions), plus they have some capabilities that not even applications have.

> #### Capabilities that Applications Don't Have

> > Applets get extra capabilities because they are supported by code in the application they run in. Applets have access to this support through the `java.applet` package, which contains the `Applet` class and the `AppletContext`, `AppletStub`, and `AudioClip` interfaces.

> > Here are some capabilities that applets have and applications don't:

> > Applets can play sounds.
> >   The JDK 1.0.2 release does not support sound in applications. See Playing Sounds for information.

> > Applets running within a Web browser can easily cause HTML documents to be displayed.
> >   This is supported with the `AppletContext` `showDocument` methods. See Communicating with the Browser for more information.

> > Applets can invoke public methods of other applets on the same page.
> >   See Sending Messages to Other Applets On the Same Page for information.

> #### More Applet Capabilities

> > Besides the above capabilities, applets have some more that you might not expect:
> > Applets that are loaded from the local file system (from a directory in the user's `CLASSPATH`) have none of the restrictions that applets loaded over the network do.
> >   This is because an applet that is in the user's `CLASSPATH` has the same capabilities as the Java application that loads it. See `CLASSPATH` for more information.

> > Although most applets stop running once you leave their page, they don't have to.
> >   Most applets, to be polite, implement the `stop` method (if necessary) to stop any processing when the user leaves the applet's page. Sometimes, however, it's appropriate for an applet to continue executing. For example, if a user tells an applet to perform a complex calculation, the user might want the calculation to continue. (The user should generally be able to specify whether it should continue, though.) As another example, if an applet might be useful over multiple pages, it should use a window for its interface (and not hide the window in its `stop` method). The user can then dismiss the window when it's no longer needed.

| Understanding Applet Capabilities and Restrictions