java.applet

Interface AppletContext

public interface AppletContext

This interface allows an applet access to the browser to retrieve additional data files and display documents. It also allows the applet to find out other applets in the same document.

Since: 1.0

UNKNOWN: updated to 1.5

Method Summary
AppletgetApplet(String name)
Returns the applet in the document for this object that has the specified name.
Enumeration<Applet>getApplets()
Returns a list of all the applets in the document for this object.
AudioClipgetAudioClip(URL url)
Returns an audio clip from the specified URL.
ImagegetImage(URL url)
Returns an image from the specified URL.
InputStreamgetStream(String key)
Return the stream associated with a given key in this applet context, or null if nothing is associated.
Iterator<String>getStreamKeys()
Iterate over all keys that have associated streams.
voidsetStream(String key, InputStream stream)
Associate a stream to a key for this applet context, possibly replacing the old value.
voidshowDocument(URL url)
Displays the web page pointed to by the specified URL in the window for this object.
voidshowDocument(URL url, String target)
Displays the web page pointed to be the sepcified URL in the window with the specified name.
voidshowStatus(String message)
Displays the specified message in the status window if that window exists.

Method Detail

getApplet

public Applet getApplet(String name)
Returns the applet in the document for this object that has the specified name.

Parameters: name the applet name

Returns: the requested applet, or null if not found

getApplets

public Enumeration<Applet> getApplets()
Returns a list of all the applets in the document for this object.

Returns: a list of all the applets

getAudioClip

public AudioClip getAudioClip(URL url)
Returns an audio clip from the specified URL.

Parameters: url the URL of the audio clip

Returns: the retrieved audio clip

Throws: NullPointerException if url is null

getImage

public Image getImage(URL url)
Returns an image from the specified URL. Note that the image is not actually retrieved until the applet attempts to display it, so this method returns immediately.

Parameters: url the absolute URL of the image

Returns: the retrieved image

Throws: NullPointerException if url is null

getStream

public InputStream getStream(String key)
Return the stream associated with a given key in this applet context, or null if nothing is associated. Stream associations are local to the applet context, for security purposes.

Parameters: key the key to look up

Returns: the associated stream, or null

Since: 1.4

getStreamKeys

public Iterator<String> getStreamKeys()
Iterate over all keys that have associated streams. Stream associated are local to the applet context, for security purposes.

Returns: an iterator over the association keys

Since: 1.4

setStream

public void setStream(String key, InputStream stream)
Associate a stream to a key for this applet context, possibly replacing the old value. Stream associations are local to the applet context, for security purposes.

Parameters: key the key to associate with stream the stream value to tie to the key, or null to remove

Throws: IOException if the stream is too large

Since: 1.4

showDocument

public void showDocument(URL url)
Displays the web page pointed to by the specified URL in the window for this object. This page replaces the document that is currently there.

Parameters: url the URL of the web page to load; unspecified on an error

showDocument

public void showDocument(URL url, String target)
Displays the web page pointed to be the sepcified URL in the window with the specified name. The standard names "_top", "_blank", "_parent", and "_self" are allowed. An applet viewer may disregard this request.

Parameters: url the URL of the web page to load target the target window

showStatus

public void showStatus(String message)
Displays the specified message in the status window if that window exists.

Parameters: message the status message, may be null