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
Questions and Exercises: Java Applets

### Questions

> 1. Which classes can an applet extend?

> 2. How do you cause the applet GUI in the browser to be refreshed when data in it may have changed?

> 3. For what do you use the `start()` method?

> 4. True or false: An applet can make network connections to any host on the Internet.

> 5. How do you get the value of a parameter specified in the `APPLET` tag from within the applet's code?

> 6. True or false: An applet can run multiple threads.

> 7. Match the following tag names with the descriptions in the following lists:
>    1. `EMBED` tag
>    2. `APPLET` tag
>    3. `OBJECT` tag

>    1. Use to deploy applets to a multi-browser environment.
>    2. Use to deploy applets that are to be used only with the Mozilla family of browsers
>    3. Use to deploy applets that are to be used only with Internet Explorer

### Exercises

> 1. For an applet using the `Exercise` class, write the `Applet` tag that sets the `ButtonName` parameter to `Save`.

> 2. Write the method to display an applet in the browser, so that the contents are contained in a rectangle around the phrase "Exercise Applet". Have the applet be one pixel less than the size specified on the web page, and the phrase starting at the coordinates 5, 15.
> Check your answers.

Previous page: Solving Common Applet Problems
Next page: End of Trail