home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / applet / AppletContext.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  4.9 KB  |  131 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)AppletContext.java    1.23 98/06/29
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.applet;
  16.  
  17. import java.awt.Image;
  18. import java.awt.Graphics;
  19. import java.awt.image.ColorModel;
  20. import java.net.URL;
  21. import java.util.Enumeration;
  22.  
  23. /**
  24.  * This interface corresponds to an applet's environment: the
  25.  * document containing the applet and the other applets in the same
  26.  * document.
  27.  * <p>
  28.  * The methods in this interface can be used by an applet to obtain
  29.  * information about its environment.
  30.  *
  31.  * @author     Arthur van Hoff
  32.  * @version     1.23, 06/29/98
  33.  * @since       JDK1.0
  34.  */
  35. public interface AppletContext {
  36.     /**
  37.      * Creates an audio clip.
  38.      *
  39.      * @param   url   an absolute URL giving the location of the audio clip.
  40.      * @return  the audio clip at the specified URL.
  41.      */
  42.     AudioClip getAudioClip(URL url);
  43.  
  44.     /**
  45.      * Returns an <code>Image</code> object that can then be painted on
  46.      * the screen. The <code>url</code> argument<code> </code>that is
  47.      * passed as an argument must specify an absolute URL.
  48.      * <p>
  49.      * This method always returns immediately, whether or not the image
  50.      * exists. When the applet attempts to draw the image on the screen,
  51.      * the data will be loaded. The graphics primitives that draw the
  52.      * image will incrementally paint on the screen.
  53.      *
  54.      * @param   url   an absolute URL giving the location of the image.
  55.      * @return  the image at the specified URL.
  56.      * @see     java.awt.Image
  57.      */
  58.     Image getImage(URL url);
  59.  
  60.     /**
  61.      * Finds and returns the applet in the document represented by this
  62.      * applet context with the given name. The name can be set in the
  63.      * HTML tag by setting the <code>name</code> attribute.
  64.      *
  65.      * @param   name   an applet name.
  66.      * @return  the applet with the given name, or <code>null</code> if
  67.      *          not found.
  68.      */
  69.     Applet getApplet(String name);
  70.  
  71.     /**
  72.      * Finds all the applets in the document represented by this applet
  73.      * context.
  74.      *
  75.      * @return  an enumeration of all applets in the document represented by
  76.      *          this applet context.
  77.      */
  78.     Enumeration getApplets();
  79.  
  80.     /**
  81.      * Replaces the Web page currently being viewed with the given URL.
  82.      * This method may be ignored by applet contexts that are not
  83.      * browsers.
  84.      *
  85.      * @param   url   an absolute URL giving the location of the document.
  86.      */
  87.     void showDocument(URL url);
  88.  
  89.     /**
  90.      * Requests that the browser or applet viewer show the Web page
  91.      * indicated by the <code>url</code> argument. The
  92.      * <code>target</code> argument indicates in which HTML frame the
  93.      * document is to be displayed.
  94.      * The target argument is interpreted as follows:
  95.      * <p>
  96.      * <center><table border="3">
  97.      * <tr><td><code>"_self"</code>  <td>Show in the window and frame that
  98.      *                                   contain the applet.</tr>
  99.      * <tr><td><code>"_parent"</code><td>Show in the applet's parent frame. If
  100.      *                                   the applet's frame has no parent frame,
  101.      *                                   acts the same as "_self".</tr>
  102.      * <tr><td><code>"_top"</code>   <td>Show in the top-level frame of the applet's
  103.      *                                   window. If the applet's frame is the
  104.      *                                   top-level frame, acts the same as "_self".</tr>
  105.      * <tr><td><code>"_blank"</code> <td>Show in a new, unnamed
  106.      *                                   top-level window.</tr>
  107.      * <tr><td><i>name</i><td>Show in the frame or window named <i>name</i>. If
  108.      *                        a target named <i>name</i> does not already exist, a
  109.      *                        new top-level window with the specified name is created,
  110.      *                        and the document is shown there.</tr>
  111.      * </table> </center>
  112.      * <p>
  113.      * An applet viewer or browser is free to ignore <code>showDocument</code>.
  114.      *
  115.      * @param   url   an absolute URL giving the location of the document.
  116.      * @param   target   a <code>String</code> indicating where to display
  117.      *                   the page.
  118.      */
  119.     public void showDocument(URL url, String target);
  120.  
  121.     /**
  122.      * Requests that the argument string be displayed in the
  123.      * "status window". Many browsers and applet viewers
  124.      * provide such a window, where the application can inform users of
  125.      * its current state.
  126.      *
  127.      * @param   status   a string to display in the status window.
  128.      */
  129.     void showStatus(String status);
  130. }
  131.