Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
To be useful, a subclass should override at least start(). Also useful are init, stop, and destroy for control purposes, and getAppletInfo and getParameterInfo for descriptive purposes.
Nested Class Summary | |
protected class |
|
Nested classes/interfaces inherited from class java.awt.Panel | |
Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Constructor Summary | |
|
Method Summary | |
void |
|
AccessibleContext |
|
AppletContext |
|
String |
|
AudioClip |
|
AudioClip |
|
URL |
|
URL |
|
Image | |
Image | |
Locale |
|
String |
|
String[][] |
|
void |
|
boolean |
|
static AudioClip |
|
void | |
void | |
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.awt.Panel | |
addNotify , getAccessibleContext |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public Applet()
Default constructor for subclasses.
- Throws:
HeadlessException
- if in a headless environment
public void destroy()
This method is called when the applet is being unloaded. The default implementation does nothing; override for your applet to clean up resources on exit.
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this applet, creating one if necessary. This always returns an instance ofApplet.AccessibleApplet
.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface Panel
- Returns:
- the accessibility context of this applet
- Since:
- 1.3
public AppletContext getAppletContext()
Returns the applet context for this applet.
- Returns:
- the applet context for this applet
public String getAppletInfo()
Returns a descriptive string with applet defined information. The implementation in this class returnsnull
, so subclasses must override to return information.
- Returns:
- a string describing the author, version, and applet copyright
public AudioClip getAudioClip(URL url)
Returns an audio clip from the specified URL. Note that the clip is not actually retrieved until the applet attempts to play it, so this method returns immediately.
- Parameters:
url
- the URL of the audio clip
- Returns:
- the retrieved audio clip
- Throws:
NullPointerException
- if url is null
public AudioClip getAudioClip(URL url, String name)
Returns an audio clip from the specified absolute URL, and relative path from that URL. Note that the clip is not actually retrieved until the applet attempts to play it, so this method returns immediately. This callsgetAudioClip(new URL(url, name))
, but if building the new URL fails, this returns null.
- Parameters:
url
- the base URL of the audio clipname
- the name of the clip relative to the URL
- Returns:
- the retrieved audio clip, or null on failure
- See Also:
getAudioClip(URL)
public URL getCodeBase()
Returns the URL of the code base for this applet.
- Returns:
- the URL of the code base for this applet
public URL getDocumentBase()
Returns the basename URL of the document this applet is embedded in. This is everything up to the final '/'.
- Returns:
- the URL of the document this applet is embedded in
- See Also:
getCodeBase()
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 URL of the image
- Returns:
- the retrieved image
- Throws:
NullPointerException
- if url is null
public Image getImage(URL url, String name)
Returns an image from the specified absolute URL, and relative path from that URL. Note that the image is not actually retrieved until the applet attempts to display it, so this method returns immediately. This callsgetImage(new URL(url, name))
, but if building the new URL fails, this returns null.
- Parameters:
url
- the base URL of the imagename
- the name of the image relative to the URL
- Returns:
- the retrieved image, or null on failure
- See Also:
getImage(URL)
public Locale getLocale()
Returns the locale for this applet, if it has been set. If no applet specific locale has been set, the default locale is returned.
- Returns:
- the locale for this applet
- Since:
- 1.1
- See Also:
Component.setLocale(Locale)
public String getParameter(String name)
Returns the value of the specified parameter that was specified in the<APPLET>
tag for this applet.
- Parameters:
name
- the parameter name
- Returns:
- the parameter value, or null if the parameter does not exist
- Throws:
NullPointerException
- if name is null
public String[][] getParameterInfo()
Returns a list of parameters this applet supports. Each element of the outer array is an array of three strings with the name of the parameter, the data type or valid values, and a description. This method is optional and the default implementation returns null.
- Returns:
- the list of parameters supported by this applet
public void init()
This method is called when the applet is first loaded, before start(). The default implementation does nothing; override to do any one-time initialization.
public boolean isActive()
Tests whether or not this applet is currently active. An applet is active just before the browser invokes start(), and becomes inactive just before the browser invokes stop().
- Returns:
true
if this applet is active
public static final AudioClip newAudioClip(URL url)
Returns an audio clip from the specified URL. This clip is not tied to any particular applet.
- Parameters:
url
- the URL of the audio clip
- Returns:
- the retrieved audio clip
- Throws:
NullPointerException
- if url is null
- Since:
- 1.2
- See Also:
getAudioClip(URL)
public void play(URL url)
Loads and plays the audio clip pointed to by the specified URL. This does nothing if the URL does not point to a valid audio clip.
- Parameters:
url
- the URL of the audio clip
- Throws:
NullPointerException
- if url is null
- See Also:
getAudioClip(URL)
public void play(URL url, String name)
Loads and plays the audio clip pointed to by the specified absolute URL, and relative path from that URL. This does nothing if the URL cannot be constructed, or if it does not point to a valid audio clip.
- Parameters:
url
- the base URL of the audio clipname
- the name of the audio clip relative to the URL
- See Also:
getAudioClip(URL,String)
,play(URL)
public void resize(int width, int height)
Requests that the applet window for this applet be resized.
- Parameters:
width
- the new width in pixelsheight
- the new height in pixels
public void resize(Dimension dim)
Requests that the applet window for this applet be resized.
- Parameters:
dim
- the requested dimensions
- Throws:
NullPointerException
- if dim is null
public final void setStub(AppletStub stub)
The browser calls this method to set the applet's stub, which is the low level interface to the browser. Manually setting this to null is asking for problems down the road.
- Parameters:
stub
- the applet stub for this applet
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
public void start()
This method is called when the applet should start running. This is normally each time a web page containing it is loaded. The default implemention does nothing; override for your applet to be useful.
public void stop()
This method is called when the applet should stop running. This is normally when the next web page is loaded. The default implementation does nothing; override for your applet to stop using resources when it is no longer visible, but may be restarted soon.