0N/A/*
2362N/A * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.applet;
0N/A
0N/Aimport java.awt.Image;
0N/Aimport java.awt.Graphics;
0N/Aimport java.awt.image.ColorModel;
0N/Aimport java.net.URL;
0N/Aimport java.util.Enumeration;
0N/Aimport java.io.InputStream;
0N/Aimport java.io.IOException;
0N/Aimport java.util.Iterator;
0N/A
0N/A/**
0N/A * This interface corresponds to an applet's environment: the
0N/A * document containing the applet and the other applets in the same
0N/A * document.
0N/A * <p>
0N/A * The methods in this interface can be used by an applet to obtain
0N/A * information about its environment.
0N/A *
0N/A * @author Arthur van Hoff
0N/A * @since JDK1.0
0N/A */
0N/Apublic interface AppletContext {
0N/A /**
0N/A * Creates an audio clip.
0N/A *
0N/A * @param url an absolute URL giving the location of the audio clip.
0N/A * @return the audio clip at the specified URL.
0N/A */
0N/A AudioClip getAudioClip(URL url);
0N/A
0N/A /**
0N/A * Returns an <code>Image</code> object that can then be painted on
0N/A * the screen. The <code>url</code> argument<code> </code>that is
0N/A * passed as an argument must specify an absolute URL.
0N/A * <p>
0N/A * This method always returns immediately, whether or not the image
0N/A * exists. When the applet attempts to draw the image on the screen,
0N/A * the data will be loaded. The graphics primitives that draw the
0N/A * image will incrementally paint on the screen.
0N/A *
0N/A * @param url an absolute URL giving the location of the image.
0N/A * @return the image at the specified URL.
0N/A * @see java.awt.Image
0N/A */
0N/A Image getImage(URL url);
0N/A
0N/A /**
0N/A * Finds and returns the applet in the document represented by this
0N/A * applet context with the given name. The name can be set in the
0N/A * HTML tag by setting the <code>name</code> attribute.
0N/A *
0N/A * @param name an applet name.
0N/A * @return the applet with the given name, or <code>null</code> if
0N/A * not found.
0N/A */
0N/A Applet getApplet(String name);
0N/A
0N/A /**
0N/A * Finds all the applets in the document represented by this applet
0N/A * context.
0N/A *
0N/A * @return an enumeration of all applets in the document represented by
0N/A * this applet context.
0N/A */
0N/A Enumeration<Applet> getApplets();
0N/A
0N/A /**
0N/A * Requests that the browser or applet viewer show the Web page
0N/A * indicated by the <code>url</code> argument. The browser or
0N/A * applet viewer determines which window or frame to display the
0N/A * Web page. This method may be ignored by applet contexts that
0N/A * are not browsers.
0N/A *
0N/A * @param url an absolute URL giving the location of the document.
0N/A */
0N/A void showDocument(URL url);
0N/A
0N/A /**
0N/A * Requests that the browser or applet viewer show the Web page
0N/A * indicated by the <code>url</code> argument. The
0N/A * <code>target</code> argument indicates in which HTML frame the
0N/A * document is to be displayed.
0N/A * The target argument is interpreted as follows:
0N/A * <p>
0N/A * <center><table border="3" summary="Target arguments and their descriptions">
0N/A * <tr><th>Target Argument</th><th>Description</th></tr>
0N/A * <tr><td><code>"_self"</code> <td>Show in the window and frame that
0N/A * contain the applet.</tr>
0N/A * <tr><td><code>"_parent"</code><td>Show in the applet's parent frame. If
0N/A * the applet's frame has no parent frame,
0N/A * acts the same as "_self".</tr>
0N/A * <tr><td><code>"_top"</code> <td>Show in the top-level frame of the applet's
0N/A * window. If the applet's frame is the
0N/A * top-level frame, acts the same as "_self".</tr>
0N/A * <tr><td><code>"_blank"</code> <td>Show in a new, unnamed
0N/A * top-level window.</tr>
0N/A * <tr><td><i>name</i><td>Show in the frame or window named <i>name</i>. If
0N/A * a target named <i>name</i> does not already exist, a
0N/A * new top-level window with the specified name is created,
0N/A * and the document is shown there.</tr>
0N/A * </table> </center>
0N/A * <p>
0N/A * An applet viewer or browser is free to ignore <code>showDocument</code>.
0N/A *
0N/A * @param url an absolute URL giving the location of the document.
0N/A * @param target a <code>String</code> indicating where to display
0N/A * the page.
0N/A */
0N/A public void showDocument(URL url, String target);
0N/A
0N/A /**
0N/A * Requests that the argument string be displayed in the
0N/A * "status window". Many browsers and applet viewers
0N/A * provide such a window, where the application can inform users of
0N/A * its current state.
0N/A *
0N/A * @param status a string to display in the status window.
0N/A */
0N/A void showStatus(String status);
0N/A
0N/A /**
0N/A * Associates the specified stream with the specified key in this
0N/A * applet context. If the applet context previously contained a mapping
0N/A * for this key, the old value is replaced.
0N/A * <p>
0N/A * For security reasons, mapping of streams and keys exists for each
0N/A * codebase. In other words, applet from one codebase cannot access
0N/A * the streams created by an applet from a different codebase
0N/A * <p>
0N/A * @param key key with which the specified value is to be associated.
0N/A * @param stream stream to be associated with the specified key. If this
0N/A * parameter is <code>null</code>, the specified key is removed
0N/A * in this applet context.
0N/A * @throws <code>IOException</code> if the stream size exceeds a certain
0N/A * size limit. Size limit is decided by the implementor of this
0N/A * interface.
0N/A * @since 1.4
0N/A */
0N/A public void setStream(String key, InputStream stream)throws IOException;
0N/A
0N/A /**
0N/A * Returns the stream to which specified key is associated within this
0N/A * applet context. Returns <tt>null</tt> if the applet context contains
0N/A * no stream for this key.
0N/A * <p>
0N/A * For security reasons, mapping of streams and keys exists for each
0N/A * codebase. In other words, applet from one codebase cannot access
0N/A * the streams created by an applet from a different codebase
0N/A * <p>
0N/A * @return the stream to which this applet context maps the key
0N/A * @param key key whose associated stream is to be returned.
0N/A * @since 1.4
0N/A */
0N/A public InputStream getStream(String key);
0N/A
0N/A /**
0N/A * Finds all the keys of the streams in this applet context.
0N/A * <p>
0N/A * For security reasons, mapping of streams and keys exists for each
0N/A * codebase. In other words, applet from one codebase cannot access
0N/A * the streams created by an applet from a different codebase
0N/A * <p>
0N/A * @return an Iterator of all the names of the streams in this applet
0N/A * context.
0N/A * @since 1.4
0N/A */
0N/A public Iterator<String> getStreamKeys();
0N/A}