Showing the changes to java/pkg2/java/applet/AppletContext.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,194 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. | |
| 4 | + * | |
| 5 | + * | |
| 6 | + * | |
| 7 | + * | |
| 8 | + * | |
| 9 | + * | |
| 10 | + * | |
| 11 | + * | |
| 12 | + * | |
| 13 | + * | |
| 14 | + * | |
| 15 | + * | |
| 16 | + * | |
| 17 | + * | |
| 18 | + * | |
| 19 | + * | |
| 20 | + * | |
| 21 | + * | |
| 22 | + * | |
| 23 | + * | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.applet; | |
| 27 | + | |
| 28 | +import java.awt.Image; | |
| 29 | +import java.awt.Graphics; | |
| 30 | +import java.awt.image.ColorModel; | |
| 31 | +import java.net.URL; | |
| 32 | +import java.util.Enumeration; | |
| 33 | +import java.io.InputStream; | |
| 34 | +import java.io.IOException; | |
| 35 | +import java.util.Iterator; | |
| 36 | + | |
| 37 | +/** | |
| 38 | + * This interface corresponds to an applet's environment: the | |
| 39 | + * document containing the applet and the other applets in the same | |
| 40 | + * document. | |
| 41 | + * <p> | |
| 42 | + * The methods in this interface can be used by an applet to obtain | |
| 43 | + * information about its environment. | |
| 44 | + * | |
| 45 | + * @author Arthur van Hoff | |
| 46 | + * @since JDK1.0 | |
| 47 | + */ | |
| 48 | +public interface AppletContext { | |
| 49 | + /** | |
| 50 | + * Creates an audio clip. | |
| 51 | + * | |
| 52 | + * @param url an absolute URL giving the location of the audio clip. | |
| 53 | + * @return the audio clip at the specified URL. | |
| 54 | + */ | |
| 55 | + AudioClip getAudioClip(URL url); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * Returns an <code>Image</code> object that can then be painted on | |
| 59 | + * the screen. The <code>url</code> argument<code> </code>that is | |
| 60 | + * passed as an argument must specify an absolute URL. | |
| 61 | + * <p> | |
| 62 | + * This method always returns immediately, whether or not the image | |
| 63 | + * exists. When the applet attempts to draw the image on the screen, | |
| 64 | + * the data will be loaded. The graphics primitives that draw the | |
| 65 | + * image will incrementally paint on the screen. | |
| 66 | + * | |
| 67 | + * @param url an absolute URL giving the location of the image. | |
| 68 | + * @return the image at the specified URL. | |
| 69 | + * @see java.awt.Image | |
| 70 | + */ | |
| 71 | + Image getImage(URL url); | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * Finds and returns the applet in the document represented by this | |
| 75 | + * applet context with the given name. The name can be set in the | |
| 76 | + * HTML tag by setting the <code>name</code> attribute. | |
| 77 | + * | |
| 78 | + * @param name an applet name. | |
| 79 | + * @return the applet with the given name, or <code>null</code> if | |
| 80 | + * not found. | |
| 81 | + */ | |
| 82 | + Applet getApplet(String name); | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Finds all the applets in the document represented by this applet | |
| 86 | + * context. | |
| 87 | + * | |
| 88 | + * @return an enumeration of all applets in the document represented by | |
| 89 | + * this applet context. | |
| 90 | + */ | |
| 91 | + Enumeration<Applet> getApplets(); | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Requests that the browser or applet viewer show the Web page | |
| 95 | + * indicated by the <code>url</code> argument. The browser or | |
| 96 | + * applet viewer determines which window or frame to display the | |
| 97 | + * Web page. This method may be ignored by applet contexts that | |
| 98 | + * are not browsers. | |
| 99 | + * | |
| 100 | + * @param url an absolute URL giving the location of the document. | |
| 101 | + */ | |
| 102 | + void showDocument(URL url); | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * Requests that the browser or applet viewer show the Web page | |
| 106 | + * indicated by the <code>url</code> argument. The | |
| 107 | + * <code>target</code> argument indicates in which HTML frame the | |
| 108 | + * document is to be displayed. | |
| 109 | + * The target argument is interpreted as follows: | |
| 110 | + * <p> | |
| 111 | + * <center><table border="3" summary="Target arguments and their descriptions"> | |
| 112 | + * <tr><th>Target Argument</th><th>Description</th></tr> | |
| 113 | + * <tr><td><code>"_self"</code> <td>Show in the window and frame that | |
| 114 | + * contain the applet.</tr> | |
| 115 | + * <tr><td><code>"_parent"</code><td>Show in the applet's parent frame. If | |
| 116 | + * the applet's frame has no parent frame, | |
| 117 | + * acts the same as "_self".</tr> | |
| 118 | + * <tr><td><code>"_top"</code> <td>Show in the top-level frame of the applet's | |
| 119 | + * window. If the applet's frame is the | |
| 120 | + * top-level frame, acts the same as "_self".</tr> | |
| 121 | + * <tr><td><code>"_blank"</code> <td>Show in a new, unnamed | |
| 122 | + * top-level window.</tr> | |
| 123 | + * <tr><td><i>name</i><td>Show in the frame or window named <i>name</i>. If | |
| 124 | + * a target named <i>name</i> does not already exist, a | |
| 125 | + * new top-level window with the specified name is created, | |
| 126 | + * and the document is shown there.</tr> | |
| 127 | + * </table> </center> | |
| 128 | + * <p> | |
| 129 | + * An applet viewer or browser is free to ignore <code>showDocument</code>. | |
| 130 | + * | |
| 131 | + * @param url an absolute URL giving the location of the document. | |
| 132 | + * @param target a <code>String</code> indicating where to display | |
| 133 | + * the page. | |
| 134 | + */ | |
| 135 | + public void showDocument(URL url, String target); | |
| 136 | + | |
| 137 | + /** | |
| 138 | + * Requests that the argument string be displayed in the | |
| 139 | + * "status window". Many browsers and applet viewers | |
| 140 | + * provide such a window, where the application can inform users of | |
| 141 | + * its current state. | |
| 142 | + * | |
| 143 | + * @param status a string to display in the status window. | |
| 144 | + */ | |
| 145 | + void showStatus(String status); | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * Associates the specified stream with the specified key in this | |
| 149 | + * applet context. If the applet context previously contained a mapping | |
| 150 | + * for this key, the old value is replaced. | |
| 151 | + * <p> | |
| 152 | + * For security reasons, mapping of streams and keys exists for each | |
| 153 | + * codebase. In other words, applet from one codebase cannot access | |
| 154 | + * the streams created by an applet from a different codebase | |
| 155 | + * <p> | |
| 156 | + * @param key key with which the specified value is to be associated. | |
| 157 | + * @param stream stream to be associated with the specified key. If this | |
| 158 | + * parameter is <code>null</code>, the specified key is removed | |
| 159 | + * in this applet context. | |
| 160 | + * @throws <code>IOException</code> if the stream size exceeds a certain | |
| 161 | + * size limit. Size limit is decided by the implementor of this | |
| 162 | + * interface. | |
| 163 | + * @since 1.4 | |
| 164 | + */ | |
| 165 | + public void setStream(String key, InputStream stream)throws IOException; | |
| 166 | + | |
| 167 | + /** | |
| 168 | + * Returns the stream to which specified key is associated within this | |
| 169 | + * applet context. Returns <tt>null</tt> if the applet context contains | |
| 170 | + * no stream for this key. | |
| 171 | + * <p> | |
| 172 | + * For security reasons, mapping of streams and keys exists for each | |
| 173 | + * codebase. In other words, applet from one codebase cannot access | |
| 174 | + * the streams created by an applet from a different codebase | |
| 175 | + * <p> | |
| 176 | + * @return the stream to which this applet context maps the key | |
| 177 | + * @param key key whose associated stream is to be returned. | |
| 178 | + * @since 1.4 | |
| 179 | + */ | |
| 180 | + public InputStream getStream(String key); | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * Finds all the keys of the streams in this applet context. | |
| 184 | + * <p> | |
| 185 | + * For security reasons, mapping of streams and keys exists for each | |
| 186 | + * codebase. In other words, applet from one codebase cannot access | |
| 187 | + * the streams created by an applet from a different codebase | |
| 188 | + * <p> | |
| 189 | + * @return an Iterator of all the names of the streams in this applet | |
| 190 | + * context. | |
| 191 | + * @since 1.4 | |
| 192 | + */ | |
| 193 | + public Iterator<String> getStreamKeys(); | |
| 194 | +} | |