java.applet
Class Applet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
All Implemented Interfaces:
java.awt.image.ImageObserver

public class Applet
extends Panel

Base applet class.


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Applet()
           
 
Method Summary
 void destroy()
          Cleans up whatever resources are being held.
 AppletContext getAppletContext()
          Gets a handle to the applet context.
 String getAppletInfo()
          Returns a string containing information about the author, version and copyright of the applet.
 AudioClip getAudioClip(URL url)
          Gets an audio clip.
 AudioClip getAudioClip(URL url, String name)
          Gets an audio clip.
 URL getCodeBase()
          Gets the base URL.
 URL getDocumentBase()
          Gets the document URL.
 Image getImage(URL url)
          Gets an image given a URL.
 Image getImage(URL url, String name)
          Gets an image relative to a URL.
 String getParameter(String name)
          Gets a parameter of the applet.
 String[][] getParameterInfo()
          Returns an array of strings describing the parameters that are understood by this applet.
 void init()
          Initializes the applet.
 boolean isActive()
          Returns true if the applet is active.
 void play(URL url)
          Plays an audio clip.
 void play(URL url, String name)
          Plays an audio clip.
 void resize(Dimension d)
          Requests thatthe applet be resized.
 void resize(int width, int height)
          Requests that the applet be resized.
 void setStub(AppletStub stub)
          Sets the applet stub.
 void showStatus(String msg)
          Shows a status message in the applet's context.
 void start()
          Called to start the applet.
 void stop()
          Called to stop the applet.
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, countComponents, deliverEvent, getComponent, getComponents, getLayout, insets, layout, list, locate, minimumSize, paintComponents, paramString, preferredSize, printComponents, remove, removeAll, removeNotify, setLayout, validate
 
Methods inherited from class java.awt.Component
action, bounds, checkImage, checkImage, createImage, createImage, disable, enable, enable, getBackground, getColorModel, getFont, getFontMetrics, getForeground, getGraphics, getParent, getPeer, getToolkit, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isEnabled, isShowing, isValid, isVisible, keyDown, keyUp, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setFont, setForeground, show, show, size, toString, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Applet

public Applet()
Method Detail

setStub

public final void setStub(AppletStub stub)
Sets the applet stub. This is done by automatically by the system.


isActive

public boolean isActive()
Returns true if the applet is active. An applet is marked active just before the start method is called.

See Also:
start()

getDocumentBase

public URL getDocumentBase()
Gets the document URL. This is the URL of the document in which the applet is embedded.

See Also:
getCodeBase()

getCodeBase

public URL getCodeBase()
Gets the base URL. This is the URL of the applet itself.

See Also:
getDocumentBase()

getParameter

public String getParameter(String name)
Gets a parameter of the applet.


getAppletContext

public AppletContext getAppletContext()
Gets a handle to the applet context. The applet context lets an applet control the applet's environment which is usually the browser or the applet viewer.


resize

public void resize(int width,
                   int height)
Requests that the applet be resized.

Overrides:
resize in class Component
Parameters:
width - the width of the component
height - the height of the component
See Also:
Component.size(), Component.reshape(int, int, int, int)

resize

public void resize(Dimension d)
Requests thatthe applet be resized.

Overrides:
resize in class Component
Parameters:
d - the component dimension
See Also:
Component.size(), Component.reshape(int, int, int, int)

showStatus

public void showStatus(String msg)
Shows a status message in the applet's context.


getImage

public Image getImage(URL url)
Gets an image given a URL. Note that this method always returns an image object immediatly, even if the image does not exist. The actual image data is loaded when it is first needed.


getImage

public Image getImage(URL url,
                      String name)
Gets an image relative to a URL. This methods returns immediately, even if the image does not exist. The actual image data is loaded when it is first needed.

See Also:
getImage(java.net.URL)

getAudioClip

public AudioClip getAudioClip(URL url)
Gets an audio clip.


getAudioClip

public AudioClip getAudioClip(URL url,
                              String name)
Gets an audio clip.

See Also:
getAudioClip(java.net.URL)

getAppletInfo

public String getAppletInfo()
Returns a string containing information about the author, version and copyright of the applet.


getParameterInfo

public String[][] getParameterInfo()
Returns an array of strings describing the parameters that are understood by this applet. The array consists of sets of three strings: name/type/description. For example:
 	String pinfo[][] = {
	  {"fps",    "1-10",    "frames per second"},
	  {"repeat", "boolean", "repeat image loop"},
	  {"imgs",   "url",     "directory in which the images live"}
	};
 


play

public void play(URL url)
Plays an audio clip. Nothing happens if the audio clip could not be found.


play

public void play(URL url,
                 String name)
Plays an audio clip. Nothing happens if the audio clip could not be found.


init

public void init()
Initializes the applet. You never need to call this directly, it is called automatically by the system once the applet is created.

See Also:
start(), stop(), destroy()

start

public void start()
Called to start the applet. You never need to call this method directly, it is called when the applet's document is visited.

See Also:
init(), stop(), destroy()

stop

public void stop()
Called to stop the applet. It is called when the applet's document is no longer on the screen. It is guaranteed to be called before destroy() is called. You never need to call this method directly.

See Also:
init(), start(), destroy()

destroy

public void destroy()
Cleans up whatever resources are being held. If the applet is active it is stopped stopped.

See Also:
init(), start(), stop()