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