public interface AppletContext
在这个接口中的方法可以使用一个小程序,以获得有关其环境的信息。
Modifier and Type | Method and Description |
---|---|
Applet |
getApplet(String name)
查找并返回在这个小程序上下文与给定的名称所表示的文档中的小程序。
|
Enumeration<Applet> |
getApplets()
通过这个小程序上下文表示文件中找到所有的应用程序。
|
AudioClip |
getAudioClip(URL url)
创建一个音频剪辑。
|
Image |
getImage(URL url)
返回一个对象,
Image 然后可以画在屏幕上。
|
InputStream |
getStream(String key)
返回在这个小程序上下文中关联的指定密钥的流。
|
Iterator<String> |
getStreamKeys()
在这个小程序上下文中查找流的所有键。
|
void |
setStream(String key, InputStream stream)
将指定的流与此小程序上下文中指定的键关联。
|
void |
showDocument(URL url)
浏览器的请求,或者程序浏览器显示的网页
url 参数表示。
|
void |
showDocument(URL url, String target)
浏览器的请求,或者程序浏览器显示的网页
url 参数表示。
|
void |
showStatus(String status)
请将参数字符串显示在“状态窗口”中的请求。
|
Image getImage(URL url)
Image
然后可以画在屏幕上。的
url
论点,是作为一个参数传递必须指定一个绝对URL。
此方法总是立即返回,是否存在图像。当小程序试图在屏幕上绘制图像时,数据将被加载。绘制图像的图形图元将在屏幕上增量绘制。
url
-绝对URL给图像的位置。
Image
Applet getApplet(String name)
name
属性设置在HTML标签。
name
-小程序的名字。
null
如果没有找到。
Enumeration<Applet> getApplets()
void showDocument(URL url)
url
参数表示。浏览器或小程序浏览器确定显示网页的哪一个窗口或框架。这种方法可能会被忽略的小程序上下文不是浏览器。
url
-绝对URL给文件的位置。
void showDocument(URL url, String target)
url
参数表示。的
target
参数指示在HTML框架文件将显示。目标参数的解释如下:
Target Argument | 描述 |
---|---|
"_self" |
Show in the window and frame that contain the applet. |
"_parent" |
Show in the applet's parent frame. If the applet's frame has no parent frame, acts the same as "_self". |
"_top" |
Show in the top-level frame of the applet's window. If the applet's frame is the top-level frame, acts the same as "_self". |
"_blank" |
Show in a new, unnamed top-level window. |
name | Show in the frame or window named name. If a target named name does not already exist, a new top-level window with the specified name is created, and the document is shown there. |
一个小应用程序浏览器或浏览器是忽略showDocument
。
url
-绝对URL给文件的位置。
target
-
String
指示在显示页面。
void showStatus(String status)
status
-一个字符串在状态窗口显示。
void setStream(String key, InputStream stream) throws IOException
出于安全原因,每个代码流和按键映射存在。换句话说,程序从一个代码无法访问由不同的代码小程序创建的流
key
键与指定的值是相关联的。
stream
流与指定键关联。如果这个参数是
null
,指定的关键是这个程序上下文中移除。
IOException
如果流大小超过一定大小的限制。尺寸极限是由该接口的实现者决定。
InputStream getStream(String key)
出于安全原因,每个代码流和按键映射存在。换句话说,程序从一个代码无法访问由不同的代码小程序创建的流
key
密钥的相关流要返回。
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.