1 /* 2 * Copyright (c) 1995, 2018, 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 26 package java.applet; 27 28 import java.net.URL; 29 30 /** 31 * When an applet is first created, an applet stub is attached to it 32 * using the applet's {@code setStub} method. This stub 33 * serves as the interface between the applet and the browser 34 * environment or applet viewer environment in which the application 35 * is running. 36 * 37 * @author Arthur van Hoff 38 * @see java.applet.Applet#setStub(java.applet.AppletStub) 39 * @since 1.0 40 * 41 * @deprecated The Applet API is deprecated, no replacement. 42 */ 43 @Deprecated(since = "9") 44 public interface AppletStub { 45 /** 46 * Determines if the applet is active. An applet is active just 47 * before its {@code start} method is called. It becomes 48 * inactive just before its {@code stop} method is called. 49 * 50 * @return {@code true} if the applet is active; 51 * {@code false} otherwise. 52 */ isActive()53 boolean isActive(); 54 55 56 /** 57 * Gets the URL of the document in which the applet is embedded. 58 * For example, suppose an applet is contained 59 * within the document: 60 * <blockquote><pre> 61 * http://www.oracle.com/technetwork/java/index.html 62 * </pre></blockquote> 63 * The document base is: 64 * <blockquote><pre> 65 * http://www.oracle.com/technetwork/java/index.html 66 * </pre></blockquote> 67 * 68 * @return the {@link java.net.URL} of the document that contains the 69 * applet. 70 * @see java.applet.AppletStub#getCodeBase() 71 */ getDocumentBase()72 URL getDocumentBase(); 73 74 /** 75 * Gets the base URL. This is the URL of the directory which contains the applet. 76 * 77 * @return the base {@link java.net.URL} of 78 * the directory which contains the applet. 79 * @see java.applet.AppletStub#getDocumentBase() 80 */ getCodeBase()81 URL getCodeBase(); 82 83 /** 84 * Returns the value of the named parameter in the HTML tag. For 85 * example, if an applet is specified as 86 * <blockquote><pre> 87 * <applet code="Clock" width=50 height=50> 88 * <param name=Color value="blue"> 89 * </applet> 90 * </pre></blockquote> 91 * <p> 92 * then a call to {@code getParameter("Color")} returns the 93 * value {@code "blue"}. 94 * 95 * @param name a parameter name. 96 * @return the value of the named parameter, 97 * or {@code null} if not set. 98 */ getParameter(String name)99 String getParameter(String name); 100 101 /** 102 * Returns the applet's context. 103 * 104 * @return the applet's context. 105 */ getAppletContext()106 AppletContext getAppletContext(); 107 108 /** 109 * Called when the applet wants to be resized. 110 * 111 * @param width the new requested width for the applet. 112 * @param height the new requested height for the applet. 113 */ appletResize(int width, int height)114 void appletResize(int width, int height); 115 } 116