public class Applet extends Panel
的Applet类必须是任何程序,可以嵌入在网页中的java applet查看器查看父类。的Applet类提供了应用程序和他们的环境之间的标准接口。
| Modifier and Type | Class and Description |
|---|---|
protected class |
Applet.AccessibleApplet
这个类实现了对
Applet类可访问性支持。
|
Panel.AccessibleAWTPanelContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
Applet()
构建一个新的小程序。
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
由浏览器或小程序浏览器调用来通知这个小程序,它正在被回收,它应该破坏它所分配的任何资源。
|
AccessibleContext |
getAccessibleContext()
获取与该程序相关的accessiblecontext。
|
AppletContext |
getAppletContext()
确定这个小程序的上下文,它允许小程序查询和影响它所运行的环境。
|
String |
getAppletInfo()
返回此小程序的信息。
|
AudioClip |
getAudioClip(URL url)
返回由
URL参数指定的
AudioClip对象。
|
AudioClip |
getAudioClip(URL url, String name)
返回
AudioClip对象指定的
URL和
name参数。
|
URL |
getCodeBase()
获取基本的网址。
|
URL |
getDocumentBase()
获取此小程序嵌入的文档的网址。
|
Image |
getImage(URL url)
返回一个对象,
Image然后可以画在屏幕上。
|
Image |
getImage(URL url, String name)
返回一个对象,
Image然后可以画在屏幕上。
|
Locale |
getLocale()
获取小程序的区域设置。
|
String |
getParameter(String name)
返回指定的HTML标签参数的值。
|
String[][] |
getParameterInfo()
返回由这个小程序所理解的参数的信息。
|
void |
init()
由浏览器或小程序浏览器调用来通知这个小程序,它已加载到系统中。
|
boolean |
isActive()
确定这个小程序是否是有效的。
|
boolean |
isValidateRoot()
指示此容器是否是验证根。
|
static AudioClip |
newAudioClip(URL url)
从给定的网址获取音频剪辑。
|
void |
play(URL url)
在指定的绝对网址播放音频剪辑。
|
void |
play(URL url, String name)
具有给定的URL和规范,是相对于它的音频剪辑。
|
void |
resize(Dimension d)
要求这个程序被调整。
|
void |
resize(int width, int height)
要求这个程序被调整。
|
void |
setStub(AppletStub stub)
设置这个小程序的存根。
|
void |
showStatus(String msg)
请将参数字符串显示在“状态窗口”中的请求。
|
void |
start()
由浏览器或小程序浏览器调用的通知这个小程序,它应该开始它的执行。
|
void |
stop()
由浏览器或小程序浏览器调用来通知这个小程序,它应该停止执行。
|
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, validateTreeaction, 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, getBaseline, getBaselineResizeBehavior, 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, revalidate, 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, transferFocusUpCyclepublic Applet()
throws HeadlessException
注:在java.applet.Applet许多方法可以调用的程序只有在程序完全构造;程序应避免在构造函数中调用方法java.applet.Applet。
HeadlessException -如果graphicsenvironment isheadless()返回true。
GraphicsEnvironment.isHeadless()
public final void setStub(AppletStub stub)
如果存在安全管理器,它的 checkPermission 方法被调用的AWTPermission("setAppletStub")权限如果存根已经设置。
stub -新的存根。
SecurityException如果调用者不能设置存根
public boolean isActive()
start方法称为。它成为活跃在
stop方法称为。
public URL getDocumentBase()
http://www.oracle.com/technetwork/java/index.html
文档库:
http://www.oracle.com/technetwork/java/index.html
URL。
getCodeBase()
public URL getCodeBase()
URL。
getDocumentBase()
public String getParameter(String name)
<applet code="Clock" width=50 height=50> <param name=Color value="blue"> </applet>
然后一个电话getParameter("Color")返回值"blue"。
的name参数不区分大小写。
name -参数名称。
null。
public AppletContext getAppletContext()
这个环境的一个小程序,代表包含了小程序的文档。
public void resize(int width,
int height)
public boolean isValidateRoot()
Applet对象验证根,因此,他们重写此方法以返回true。
isValidateRoot 方法重写,继承类
Container
true
Container.isValidateRoot()
public void showStatus(String msg)
msg -一个字符串在状态窗口显示。
public Image getImage(URL url)
Image然后可以画在屏幕上。是的
url通过一个参数必须指定一个绝对URL。
此方法总是立即返回,是否存在图像。当这个小程序试图在屏幕上绘制图像时,数据将被加载。绘制图像的图形图元将在屏幕上增量绘制。
url -绝对URL给图像的位置。
Image
public Image getImage(URL url, String name)
Image然后可以画在屏幕上。的
url参数必须指定一个绝对URL。的
name参数是一个说明符,相对于
url论点。
此方法总是立即返回,是否存在图像。当这个小程序试图在屏幕上绘制图像时,数据将被加载。绘制图像的图形图元将在屏幕上增量绘制。
url -绝对URL给基地的形象定位。
name -图像的位置,相对于
url论点。
Image
public static final AudioClip newAudioClip(URL url)
url点到音频剪辑
public AudioClip getAudioClip(URL url)
URL参数指定的
AudioClip对象。
此方法总是立即返回,是否存在音频剪辑。当这个小程序试图播放音频剪辑时,数据将被加载。
url -绝对URL给音频剪辑的位置。
AudioClip
public AudioClip getAudioClip(URL url, String name)
AudioClip对象指定的
URL和
name参数。
此方法总是立即返回,是否存在音频剪辑。当这个小程序试图播放音频剪辑时,数据将被加载。
url -绝对URL给音频剪辑的基地位置。
name -音频剪辑的位置,相对于
url论点。
AudioClip
public String getAppletInfo()
String包含关于作者、版本信息和程序的版权。
该方法通过Applet类提供实现返回null。
public Locale getLocale()
getLocale 方法重写,继承类
Component
Component.setLocale(java.util.Locale)
public String[][] getParameterInfo()
Strings描述这些参数的数组。
数组的每个元素都应该有一套三Strings包含名称、类型和描述。例如:
String pinfo[][] = {
{"fps", "1-10", "frames per second"},
{"repeat", "boolean", "repeat image loop"},
{"imgs", "url", "images directory"}
};
该方法通过Applet类提供实现返回null。
public void play(URL url)
url -绝对URL给音频剪辑的位置。
public void play(URL url, String name)
url -绝对URL给音频剪辑的基地位置。
name -音频剪辑的位置,相对于
url论点。
public void init()
start方法被称为第一次在叫。
对Applet子类应重写此方法,如果它已经初始化完成。例如,带螺纹的小程序将使用init方法创建线程和杀死他们的destroy方法。
该方法通过Applet类提供的实现不做任何事情。
public void start()
init方法后,每次打开一个网页的重新审视。
对Applet子类应重写此方法,如果有想做每次访问的网页包含它的任何操作。例如,动画小程序可能需要使用start方法恢复动画,和stop方法暂停动画。
注意:一些方法,如getLocationOnScreen,只能提供有意义的结果,如果程序显示。因为isShowing返回false当Applet的start第一次调用,方法需要isShowing返回true应该从ComponentListener叫。
该方法通过Applet类提供的实现不做任何事情。
public void stop()
对Applet子类应重写此方法,如果有想做一次包含它的网页不再是可见的任何操作。例如,动画小程序可能需要使用start方法恢复动画,和stop方法暂停动画。
该方法通过Applet类提供的实现不做任何事情。
public void destroy()
stop方法将总是被称为
destroy
对Applet子类应重写此方法,如果有,它希望在它被摧毁之前执行任何操作。例如,带螺纹的小程序将使用init方法创建线程和杀死他们的destroy方法。
该方法通过Applet类提供的实现不做任何事情。
public AccessibleContext getAccessibleContext()
getAccessibleContext 接口
Accessible
getAccessibleContext 方法重写,继承类
Panel
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.