init() | initializes the applet |
start() | starts the applet |
stop() | stops the applet |
destroy() | cleans up resources when applet is finished |
getAudioClip(URL url) | retrieves an audio clip |
getAudioClip(URL url, String name) | overloaded method that allows the specification of the name of the audio clip |
getCodeBase() | returns URL where the applet resides |
getDocumentBase() | returns URL of HTML page where applet is embedded |
getImage(URL url) | retrieves image |
getImage(URL url, String name) | retrieves named image |
getParameter(String name) | returns a parameter from HTML page |
getParameterInfo() | returns an array of strings that enables you to retrieve more than one parameter to the applet |
isActive() | returns Boolean identifying whether applet is active |
play(URL url) | plays an audio clip |
play(URL url, String name) | plays a named audio clip |
resize(int width, int height) | resizes the applet |
resize(Dimension d) | resizes the applet |
showStatus(String msg) | prints message on the appletviewer's status bar or a browser's panel |
Here's the complete syntax for the APPLET tag:
'<' 'APPLET'
['CODEBASE' '=' codebaseURL]
'CODE' '=' appletFile
['ALT' '=' alternateText]
['NAME' '=' appletInstanceName]
'WIDTH' '=' pixels 'HEIGHT' '=' pixels
['ALIGN' '=' alignment]
['VSPACE' '=' pixels] ['HSPACE' '=' pixels]
'>'
['<' 'PARAM' 'NAME' '=' appletAttribute1 'VALUE' '=' value '>']
['<' 'PARAM' 'NAME' '=' appletAttribute2 'VALUE' '=' value '>']
. . .
[alternateHTML]
'</APPLET>'
'CODEBASE' '=' codebaseURL
This optional attribute specifies the base URL of the applet --
the directory that contains the applet's code. If this attribute
is not specified, then the document's URL is used.
'CODE' '=' appletFile
This required attribute gives the name of the file that contains
the applet's compiled Applet subclass. This file is relative to
the base URL of the applet. It cannot be absolute.
'ALT' '=' alternateText
This optional attribute specifies any text that should be
displayed if the browser understands the APPLET tag but can't
run Java applets.
'NAME' '=' appletInstanceName
This optional attribute specifies a name for the applet instance,
which makes it possible for applets on the same page to find (and
communicate with) each other.
'WIDTH' '=' pixels 'HEIGHT' '=' pixels
These required attributes give the initial width and height (in
pixels) of the applet display area, not counting any windows or
dialogs that the applet brings up.
'ALIGN' '=' alignment
This required attribute specifies the alignment of the applet.
The possible values of this attribute are the same as those for
the IMG tag: left, right, top, texttop, middle, absmiddle,
baseline, bottom, absbottom.
'VSPACE' '=' pixels 'HSPACE' '=' pixels
These option attributes specify the number of pixels above and
below the applet (VSPACE) and on each side of the applet (HSPACE).
They're treated the same way as the IMG tag's VSPACE and HSPACE
attributes.
'<' 'PARAM' 'NAME' '=' appletAttribute1 'VALUE' '=' value '>' . . .
This tag is the only way to specify an applet-specific attribute.
Applets access their attributes with the getParameter() method.
ex.
<APPLET CODE = ImageLoopItem
CODEBASE=http://java.sun.com/applets/applets/ImageLoop/
width = 80
height = 90>
<PARAM NAME=nimgs VALUE=10>
<PARAM NAME=img VALUE=duke>
<PARAM NAME=pause VALUE=1000>