Skip to Content
Java AWT Reference
book

Java AWT Reference

by John Zukowski
April 1997
Intermediate to advanced
1074 pages
22h 46m
English
O'Reilly Media, Inc.
Content preview from Java AWT Reference

14

And Then There Were Applets

In this chapter:

  • What's a Java Applet?
  • AudioClip Interface
  • AppletContext Interface
  • AppletStub Interface
  • Audio in Applications

Although it is not part of the java.awt package, the java.applet package is closely related. The java.applet package provides support for running an applet in the context of a World Wide Web browser. It consists of one class (Applet) and three interfaces (AppletContext, AudioClip, and AppletStub). The Applet class supports the “applet life cycle” methods (init(), start(), stop(), destroy()) that you override to write an applet. AudioClip provides support for audio within applets. (Applications use the sun.audio package for audio support; sun.audio is also covered in this chapter.) The AppletStub and AppletContext interfaces provide a way for the applet to interact with its run-time environment. Many of the methods of AppletStub and AppletContext are duplicated in the Applet class.

14.1 What's a Java Applet?

Much of the initial excitement about Java centered around applets. Applets are small Java programs that can be embedded within HTML pages and downloaded and executed by a web browser. Because executing code from random Internet sites presents a security risk, Java goes to great lengths to ensure the integrity of the program executing and to prevent it from performing any unauthorized tasks.

An applet is a specific type of Java Container. The class hierarchy of an applet is shown in Figure 14-1.

When you are writing an ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Swing

Java Swing

Robert Eckstein, Marc Loy, Dave Wood

Publisher Resources

ISBN: 9781565922402