1 /* 2 * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package java.applet; 26 27 import java.net.URL; 28 29 /** 30 * When an applet is first created, an applet stub is attached to it 31 * using the applet's {@code setStub} method. This stub 32 * serves as the interface between the applet and the browser 33 * environment or applet viewer environment in which the application 34 * is running. 35 * 36 * @author Arthur van Hoff 37 * @see java.applet.Applet#setStub(java.applet.AppletStub) 38 * @since 1.0 39 * 40 * @deprecated The Applet API is deprecated. See the 41 * <a href="package-summary.html"> java.applet package documentation</a> 42 * for further information. 43 */ 44 45 @Deprecated(since = "9") 46 public interface AppletStub { 47 /** 48 * Determines if the applet is active. An applet is active just 49 * before its {@code start} method is called. It becomes 50 * inactive just before its {@code stop} method is called. 51 * 52 * @return {@code true} if the applet is active; 53 * {@code false} otherwise. 54 */ 55 boolean isActive(); 56 57 58 /** 59 * Gets the URL of the document in which the applet is embedded. 60 * For example, suppose an applet is contained 61 * within the document: 62 * <blockquote><pre> 63 * http://www.oracle.com/technetwork/java/index.html 64 * </pre></blockquote> 65 * The document base is: 66 * <blockquote><pre> 67 * http://www.oracle.com/technetwork/java/index.html 68 * </pre></blockquote> 69 * 70 * @return the {@link java.net.URL} of the document that contains the 71 * applet. 72 * @see java.applet.AppletStub#getCodeBase() 73 */ 74 URL getDocumentBase(); 75 76 /** 77 * Gets the base URL. This is the URL of the directory which contains the applet. 78 * 79 * @return the base {@link java.net.URL} of 80 * the directory which contains the applet. 81 * @see java.applet.AppletStub#getDocumentBase() 82 */ 83 URL getCodeBase(); 84 85 /** 86 * Returns the value of the named parameter in the HTML tag. For 87 * example, if an applet is specified as 88 * <blockquote><pre> 89 * <applet code="Clock" width=50 height=50> 90 * <param name=Color value="blue"> 91 * </applet> 92 * </pre></blockquote> 93 * <p> 94 * then a call to {@code getParameter("Color")} returns the 95 * value {@code "blue"}. 96 * 97 * @param name a parameter name. 98 * @return the value of the named parameter, 99 * or {@code null} if not set. 100 */ 101 String getParameter(String name); 102 103 /** 104 * Returns the applet's context. 105 * 106 * @return the applet's context. 107 */ 108 AppletContext getAppletContext(); 109 110 /** 111 * Called when the applet wants to be resized. 112 * 113 * @param width the new requested width for the applet. 114 * @param height the new requested height for the applet. 115 */ 116 void appletResize(int width, int height); 117 }