blob: 8ae108246ae371dfaa7a9a6228cd395df6952ad9 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1995-2006 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25package java.applet;
26
27import 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</code> 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 JDK1.0
39 */
40public interface AppletStub {
41 /**
42 * Determines if the applet is active. An applet is active just
43 * before its <code>start</code> method is called. It becomes
44 * inactive just before its <code>stop</code> method is called.
45 *
46 * @return <code>true</code> if the applet is active;
47 * <code>false</code> otherwise.
48 */
49 boolean isActive();
50
51
52 /**
53 * Gets the URL of the document in which the applet is embedded.
54 * For example, suppose an applet is contained
55 * within the document:
56 * <blockquote><pre>
57 * http://java.sun.com/products/jdk/1.2/index.html
58 * </pre></blockquote>
59 * The document base is:
60 * <blockquote><pre>
61 * http://java.sun.com/products/jdk/1.2/index.html
62 * </pre></blockquote>
63 *
64 * @return the {@link java.net.URL} of the document that contains the
65 * applet.
66 * @see java.applet.AppletStub#getCodeBase()
67 */
68 URL getDocumentBase();
69
70 /**
71 * Gets the base URL. This is the URL of the directory which contains the applet.
72 *
73 * @return the base {@link java.net.URL} of
74 * the directory which contains the applet.
75 * @see java.applet.AppletStub#getDocumentBase()
76 */
77 URL getCodeBase();
78
79 /**
80 * Returns the value of the named parameter in the HTML tag. For
81 * example, if 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")</code> returns the
89 * value <code>"blue"</code>.
90 *
91 * @param name a parameter name.
92 * @return the value of the named parameter,
93 * or <tt>null</tt> if not set.
94 */
95 String getParameter(String name);
96
97 /**
98 * Returns the applet's context.
99 *
100 * @return the applet's context.
101 */
102 AppletContext getAppletContext();
103
104 /**
105 * Called when the applet wants to be resized.
106 *
107 * @param width the new requested width for the applet.
108 * @param height the new requested height for the applet.
109 */
110 void appletResize(int width, int height);
111}