java.applet
Class Applet
- Accessible, ImageObserver, MenuContainer, Serializable
This is the base applet class. An applet is a Java program that
runs inside a web browser or other applet viewer in a restricted
environment.
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.
protected class | Applet.AccessibleApplet - This class provides accessibility support for Applets, and is the
runtime type returned by
getAccessibleContext() .
|
Applet() - Default constructor for subclasses.
|
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(int width, int height) - Requests that the applet window for this applet be resized.
|
void | resize(Dimension dim) - 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 , addNotify , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , countComponents , deliverEvent , doLayout , extends EventListener> T[] getListeners , findComponentAt , findComponentAt , getAlignmentX , getAlignmentY , getComponent , getComponentAt , getComponentAt , getComponentCount , getComponentZOrder , getComponents , getContainerListeners , getFocusTraversalKeys , getFocusTraversalPolicy , getInsets , getLayout , getMaximumSize , getMinimumSize , 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 , addNotify , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , bounds , checkImage , checkImage , coalesceEvents , contains , contains , createImage , createImage , createVolatileImage , createVolatileImage , deliverEvent , disable , disableEvents , dispatchEvent , doLayout , enable , enable , enableEvents , enableInputMethods , extends EventListener> T[] getListeners , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getAccessibleContext , getAlignmentX , getAlignmentY , getBackground , getBounds , getBounds , getColorModel , getComponentAt , getComponentAt , getComponentListeners , getComponentOrientation , getCursor , getDropTarget , getFocusCycleRootAncestor , getFocusListeners , getFocusTraversalKeys , getFocusTraversalKeysEnabled , getFont , getFontMetrics , getForeground , getGraphics , getGraphicsConfiguration , getHeight , getHierarchyBoundsListeners , getHierarchyListeners , getIgnoreRepaint , getInputContext , getInputMethodListeners , getInputMethodRequests , getKeyListeners , getLocale , getLocation , getLocation , getLocationOnScreen , getMaximumSize , getMinimumSize , getMouseListeners , getMouseMotionListeners , getMouseWheelListeners , getName , getParent , getPeer , getPreferredSize , getPropertyChangeListeners , getPropertyChangeListeners , getSize , getSize , getToolkit , getTreeLock , getWidth , getX , getY , gotFocus , handleEvent , hasFocus , hide , imageUpdate , inside , invalidate , isBackgroundSet , isCursorSet , isDisplayable , isDoubleBuffered , isEnabled , isFocusCycleRoot , isFocusOwner , isFocusTraversable , isFocusable , isFontSet , isForegroundSet , isLightweight , isMaximumSizeSet , isMinimumSizeSet , isOpaque , isPreferredSizeSet , isShowing , isValid , isVisible , keyDown , keyUp , layout , list , list , list , list , list , locate , location , lostFocus , minimumSize , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paint , paintAll , paramString , postEvent , preferredSize , prepareImage , prepareImage , print , printAll , processComponentEvent , processEvent , processFocusEvent , processHierarchyBoundsEvent , processHierarchyEvent , processInputMethodEvent , processKeyEvent , processMouseEvent , processMouseMotionEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removeNotify , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , repaint , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , reshape , resize , resize , setBackground , setBounds , setBounds , setComponentOrientation , setCursor , setDropTarget , setEnabled , setFocusTraversalKeys , setFocusTraversalKeysEnabled , setFocusable , setFont , setForeground , setIgnoreRepaint , setLocale , setLocation , setLocation , setMaximumSize , setMinimumSize , setName , setPreferredSize , setSize , setSize , setVisible , show , show , size , toString , transferFocus , transferFocusBackward , transferFocusUpCycle , update , validate |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Applet
public Applet()
Default constructor for subclasses.
destroy
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.
getAppletInfo
public String getAppletInfo()
Returns a descriptive string with applet defined information. The
implementation in this class returns null
, so subclasses
must override to return information.
- a string describing the author, version, and applet copyright
getAudioClip
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.
url
- the URL of the audio clip
getAudioClip
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
calls 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 URL
- the retrieved audio clip, or null on failure
getCodeBase
public URL getCodeBase()
Returns the URL of the code base for this applet.
- the URL of the code base for this applet
getDocumentBase
public URL getDocumentBase()
Returns the basename URL of the document this applet is embedded in. This
is everything up to the final '/'.
- the URL of the document this applet is embedded in
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.
url
- the URL of the image
getImage
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 calls 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 URL
- the retrieved image, or null on failure
getLocale
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.
- getLocale in interface Component
- the locale for this applet
getParameter
public String getParameter(String name)
Returns the value of the specified parameter that was specified in
the <APPLET>
tag for this applet.
name
- the parameter name
- the parameter value, or null if the parameter does not exist
getParameterInfo
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.
- the list of parameters supported by this applet
init
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.
isActive
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().
true
if this applet is active
newAudioClip
public static final AudioClip newAudioClip(URL url)
Returns an audio clip from the specified URL. This clip is not tied to
any particular applet.
url
- the URL of the audio clip
play
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.
url
- the URL of the audio clip
play
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.
url
- the base URL of the audio clipname
- the name of the audio clip relative to the URL
resize
public void resize(int width,
int height)
Requests that the applet window for this applet be resized.
- resize in interface Component
width
- the new width in pixelsheight
- the new height in pixels
resize
public void resize(Dimension dim)
Requests that the applet window for this applet be resized.
- resize in interface Component
dim
- the requested dimensions
setStub
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.
stub
- the applet stub for this applet
showStatus
public void showStatus(String message)
Displays the specified message in the status window if that window
exists.
message
- the status message, may be null
start
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.
stop
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.
Applet.java -- Java base applet class
Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.