Download the JDK
Search the Tutorials
Hide the TOC
Trail: Deployment
Lesson: Applets
Section: Finishing an Applet
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
Before You Ship that Applet

> Stop! Before you let the whole world know about your applet, make sure the answer to all of the following questions is yes.

> 1. Have you removed or disabled debugging output?

> > Debugging output (generally created with `System.out.println`), while useful to you, is generally confusing or annoying to users. If you need to give textual feedback to the user, try to do it inside the applet's display area or in the status area at the bottom of the window. Information on using the status area is in Displaying Short Status Strings.

> 2. Does the applet stop running when it's offscreen?

>    > Most applets should not use CPU resources when the browser is iconified or is displaying a page that doesn't contain the applet. If your applet code doesn't launch any threads explicitly, then you're OK.

>    > If your applet code launches any threads, then unless you have a really good excuse not to, you should implement the `stop` method so that it stops and destroys (by setting to null) the threads you launched. For an example of implementing the `stop` method, see Threads in Applets: Examples.

> 3. If the applet does something that might get annoying — play sounds or animation, for example — does it give the user a way of stopping the annoying behavior?

>    > Be kind to your users. Give them a way to stop the applet in its tracks, without leaving the page. In an applet that otherwise doesn't respond to mouse clicks, you can do this by implementing the `mouseDown` method so that a mouse click suspends or resumes the annoying thread. For example:

>    > >     boolean frozen = false; //an instance variable

>    > >     public boolean mouseDown(Event e, int x, int y) {
>    > >         if (frozen) {
>    > >             frozen = false;
>    > >             start();
>    > >         } else {
>    > >             frozen = true;
>    > >             stop();
>    > >         }
>    > >         return true;
>    > >     }

Previous page: Finishing an Applet
Next page: The Perfectly Finished Applet