java.applet
public class Applet extends Panel
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.
Modifier and Type | Class and Description |
---|---|
protected class |
Applet.AccessibleApplet
This class provides accessibility support for Applets, and is the
runtime type returned by
Component.getAccessibleContext() . |
Panel.AccessibleAWTPanel
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Applet()
Default constructor for subclasses.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
This method is called when the applet is being unloaded.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this applet, creating one if
necessary.
|
AppletContext |
getAppletContext()
Returns the applet context for this applet.
|
String |
getAppletInfo()
Returns a descriptive string with applet defined information.
|
AudioClip |
getAudioClip(URL url)
Returns an audio clip from the specified URL.
|
AudioClip |
getAudioClip(URL url,
String name)
Returns an audio clip from the specified absolute URL, and relative path
from that URL.
|
URL |
getCodeBase()
Returns the URL of the code base for this applet.
|
URL |
getDocumentBase()
Returns the basename URL of the document this applet is embedded in.
|
Image |
getImage(URL url)
Returns an image from the specified URL.
|
Image |
getImage(URL url,
String name)
Returns an image from the specified absolute URL, and relative path
from that URL.
|
Locale |
getLocale()
Returns the locale for this applet, if it has been set.
|
String |
getParameter(String name)
Returns the value of the specified parameter that was specified in
the
<APPLET> tag for this applet. |
String[][] |
getParameterInfo()
Returns a list of parameters this applet supports.
|
void |
init()
This method is called when the applet is first loaded, before start().
|
boolean |
isActive()
Tests whether or not this applet is currently active.
|
static AudioClip |
newAudioClip(URL url)
Returns an audio clip from the specified URL.
|
void |
play(URL url)
Loads and plays the audio clip pointed to by the specified URL.
|
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.
|
void |
resize(Dimension dim)
Requests that the applet window for this applet be resized.
|
void |
resize(int width,
int height)
Requests that the applet window for this applet be resized.
|
void |
setStub(AppletStub stub)
The browser calls this method to set the applet's stub, which is the
low level interface to the browser.
|
void |
showStatus(String message)
Displays the specified message in the status window if that window
exists.
|
void |
start()
This method is called when the applet should start running.
|
void |
stop()
This method is called when the applet should stop running.
|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Applet()
HeadlessException
- if in a headless environmentpublic final void setStub(AppletStub stub)
stub
- the applet stub for this appletpublic boolean isActive()
true
if this applet is activepublic URL getDocumentBase()
getCodeBase()
public URL getCodeBase()
public String getParameter(String name)
<APPLET>
tag for this applet.name
- the parameter nameNullPointerException
- if name is nullpublic AppletContext getAppletContext()
public void resize(int width, int height)
public void resize(Dimension dim)
resize
in class Component
dim
- the requested dimensionsNullPointerException
- if dim is nullpublic void showStatus(String message)
message
- the status message, may be nullpublic Image getImage(URL url)
url
- the URL of the imageNullPointerException
- if url is nullpublic Image getImage(URL url, String name)
getImage(new URL(url, name))
, but if building
the new URL fails, this returns null.url
- the base URL of the imagename
- the name of the image relative to the URLgetImage(URL)
public static final AudioClip newAudioClip(URL url)
url
- the URL of the audio clipNullPointerException
- if url is nullgetAudioClip(URL)
public AudioClip getAudioClip(URL url)
url
- the URL of the audio clipNullPointerException
- if url is nullpublic AudioClip getAudioClip(URL url, String name)
getAudioClip(new URL(url, name))
, but if building
the new URL fails, this returns null.url
- the base URL of the audio clipname
- the name of the clip relative to the URLgetAudioClip(URL)
public String getAppletInfo()
null
, so subclasses
must override to return information.public Locale getLocale()
getLocale
in class Component
Component.setLocale(Locale)
public String[][] getParameterInfo()
public void play(URL url)
url
- the URL of the audio clipNullPointerException
- if url is nullgetAudioClip(URL)
public void play(URL url, String name)
url
- the base URL of the audio clipname
- the name of the audio clip relative to the URLgetAudioClip(URL, String)
,
play(URL)
public void init()
public void start()
public void stop()
public void destroy()
public AccessibleContext getAccessibleContext()
Applet.AccessibleApplet
.getAccessibleContext
in interface Accessible
getAccessibleContext
in class Panel