1 /* 2 * @(#)AppletStub.java 1.25 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 package java.applet; 8 9 import java.net.URL; 10 11 /** 12 * When an applet is first created, an applet stub is attached to it 13 * using the applet's <code>setStub</code> method. This stub 14 * serves as the interface between the applet and the browser 15 * environment or applet viewer environment in which the application 16 * is running. 17 * 18 * @author Arthur van Hoff 19 * @version 1.25, 12/19/03 20 * @see java.applet.Applet#setStub(java.applet.AppletStub) 21 * @since JDK1.0 22 */ 23 public interface AppletStub { 24 /** 25 * Determines if the applet is active. An applet is active just 26 * before its <code>start</code> method is called. It becomes 27 * inactive just before its <code>stop</code> method is called. 28 * 29 * @return <code>true</code> if the applet is active; 30 * <code>false</code> otherwise. 31 */ 32 boolean isActive(); 33 34 35 /** 36 * Gets the URL of the document in which the applet is embedded. 37 * For example, suppose an applet is contained 38 * within the document: 39 * <blockquote><pre> 40 * http://java.sun.com/products/jdk/1.2/index.html 41 * </pre></blockquote> 42 * The document base is: 43 * <blockquote><pre> 44 * http://java.sun.com/products/jdk/1.2/index.html 45 * </pre></blockquote> 46 * 47 * @return the {@link java.net.URL} of the document that contains the 48 * applet. 49 * @see java.applet.AppletStub#getCodeBase() 50 */ 51 URL getDocumentBase(); 52 53 /** 54 * Gets the base URL. This is the URL of the directory which contains the applet. 55 * 56 * @return the base {@link java.net.URL} of 57 * the directory which contains the applet. 58 * @see java.applet.AppletStub#getDocumentBase() 59 */ 60 URL getCodeBase(); 61 62 /** 63 * Returns the value of the named parameter in the HTML tag. For 64 * example, if an applet is specified as 65 * <blockquote><pre> 66 * <applet code="Clock" width=50 height=50> 67 * <param name=Color value="blue"> 68 * </applet> 69 * </pre></blockquote> 70 * <p> 71 * then a call to <code>getParameter("Color")</code> returns the 72 * value <code>"blue"</code>. 73 * 74 * @param name a parameter name. 75 * @return the value of the named parameter, 76 * or <tt>null</tt> if not set. 77 */ 78 String getParameter(String name); 79 80 /** 81 * Gets a handler to the applet's context. 82 * 83 * @return the applet's context. 84 */ 85 AppletContext getAppletContext(); 86 87 /** 88 * Called when the applet wants to be resized. 89 * 90 * @param width the new requested width for the applet. 91 * @param height the new requested height for the applet. 92 */ 93 void appletResize(int width, int height); 94 } 95