< prev index next >

src/java.desktop/share/classes/java/applet/Applet.java

Print this page

        

*** 36,48 **** /** * An applet is a small program that is intended not to be run on * its own, but rather to be embedded inside another application. * <p> ! * The <code>Applet</code> class must be the superclass of any * applet that is to be embedded in a Web page or viewed by the Java ! * Applet Viewer. The <code>Applet</code> class provides a standard * interface between applets and their environment. * * @author Arthur van Hoff * @author Chris Warth * @since 1.0 --- 36,48 ---- /** * An applet is a small program that is intended not to be run on * its own, but rather to be embedded inside another application. * <p> ! * The {@code Applet} class must be the superclass of any * applet that is to be embedded in a Web page or viewed by the Java ! * Applet Viewer. The {@code Applet} class provides a standard * interface between applets and their environment. * * @author Arthur van Hoff * @author Chris Warth * @since 1.0
*** 50,63 **** public class Applet extends Panel { /** * Constructs a new Applet. * <p> ! * Note: Many methods in <code>java.applet.Applet</code> * may be invoked by the applet only after the applet is * fully constructed; applet should avoid calling methods ! * in <code>java.applet.Applet</code> in the constructor. * * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 --- 50,63 ---- public class Applet extends Panel { /** * Constructs a new Applet. * <p> ! * Note: Many methods in {@code java.applet.Applet} * may be invoked by the applet only after the applet is * fully constructed; applet should avoid calling methods ! * in {@code java.applet.Applet} in the constructor. * * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4
*** 86,97 **** /** * Read an applet from an object input stream. * @param s an object input stream. * @exception HeadlessException if ! * <code>GraphicsEnvironment.isHeadless()</code> returns ! * <code>true</code> * @serial * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 */ private void readObject(ObjectInputStream s) --- 86,97 ---- /** * Read an applet from an object input stream. * @param s an object input stream. * @exception HeadlessException if ! * {@code GraphicsEnvironment.isHeadless()} returns ! * {@code true} * @serial * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 */ private void readObject(ObjectInputStream s)
*** 102,114 **** s.defaultReadObject(); } /** * Sets this applet's stub. This is done automatically by the system. ! * <p>If there is a security manager, its <code> checkPermission </code> * method is called with the ! * <code>AWTPermission("setAppletStub")</code> * permission if a stub has already been set. * @param stub the new stub. * @exception SecurityException if the caller cannot set the stub */ public final void setStub(AppletStub stub) { --- 102,114 ---- s.defaultReadObject(); } /** * Sets this applet's stub. This is done automatically by the system. ! * <p>If there is a security manager, its {@code checkPermission} * method is called with the ! * {@code AWTPermission("setAppletStub")} * permission if a stub has already been set. * @param stub the new stub. * @exception SecurityException if the caller cannot set the stub */ public final void setStub(AppletStub stub) {
*** 121,135 **** this.stub = stub; } /** * Determines if this applet is active. An applet is marked active ! * just before its <code>start</code> method is called. It becomes ! * inactive just before its <code>stop</code> method is called. * ! * @return <code>true</code> if the applet is active; ! * <code>false</code> otherwise. * @see java.applet.Applet#start() * @see java.applet.Applet#stop() */ public boolean isActive() { if (stub != null) { --- 121,135 ---- this.stub = stub; } /** * Determines if this applet is active. An applet is marked active ! * just before its {@code start} method is called. It becomes ! * inactive just before its {@code stop} method is called. * ! * @return {@code true} if the applet is active; ! * {@code false} otherwise. * @see java.applet.Applet#start() * @see java.applet.Applet#stop() */ public boolean isActive() { if (stub != null) {
*** 177,194 **** * &lt;applet code="Clock" width=50 height=50&gt; * &lt;param name=Color value="blue"&gt; * &lt;/applet&gt; * </pre></blockquote> * <p> ! * then a call to <code>getParameter("Color")</code> returns the ! * value <code>"blue"</code>. * <p> ! * The <code>name</code> argument is case insensitive. * * @param name a parameter name. * @return the value of the named parameter, ! * or <code>null</code> if not set. */ public String getParameter(String name) { return stub.getParameter(name); } --- 177,194 ---- * &lt;applet code="Clock" width=50 height=50&gt; * &lt;param name=Color value="blue"&gt; * &lt;/applet&gt; * </pre></blockquote> * <p> ! * then a call to {@code getParameter("Color")} returns the ! * value {@code "blue"}. * <p> ! * The {@code name} argument is case insensitive. * * @param name a parameter name. * @return the value of the named parameter, ! * or {@code null} if not set. */ public String getParameter(String name) { return stub.getParameter(name); }
*** 258,269 **** public void showStatus(String msg) { getAppletContext().showStatus(msg); } /** ! * Returns an <code>Image</code> object that can then be painted on ! * the screen. The <code>url</code> that is passed as an argument * must specify an absolute URL. * <p> * This method always returns immediately, whether or not the image * exists. When this applet attempts to draw the image on the screen, * the data will be loaded. The graphics primitives that draw the --- 258,269 ---- public void showStatus(String msg) { getAppletContext().showStatus(msg); } /** ! * Returns an {@code Image} object that can then be painted on ! * the screen. The {@code url} that is passed as an argument * must specify an absolute URL. * <p> * This method always returns immediately, whether or not the image * exists. When this applet attempts to draw the image on the screen, * the data will be loaded. The graphics primitives that draw the
*** 276,298 **** public Image getImage(URL url) { return getAppletContext().getImage(url); } /** ! * Returns an <code>Image</code> object that can then be painted on ! * the screen. The <code>url</code> argument must specify an absolute ! * URL. The <code>name</code> argument is a specifier that is ! * relative to the <code>url</code> argument. * <p> * This method always returns immediately, whether or not the image * exists. When this applet attempts to draw the image on the screen, * the data will be loaded. The graphics primitives that draw the * image will incrementally paint on the screen. * * @param url an absolute URL giving the base location of the image. * @param name the location of the image, relative to the ! * <code>url</code> argument. * @return the image at the specified URL. * @see java.awt.Image */ public Image getImage(URL url, String name) { try { --- 276,298 ---- public Image getImage(URL url) { return getAppletContext().getImage(url); } /** ! * Returns an {@code Image} object that can then be painted on ! * the screen. The {@code url} argument must specify an absolute ! * URL. The {@code name} argument is a specifier that is ! * relative to the {@code url} argument. * <p> * This method always returns immediately, whether or not the image * exists. When this applet attempts to draw the image on the screen, * the data will be loaded. The graphics primitives that draw the * image will incrementally paint on the screen. * * @param url an absolute URL giving the base location of the image. * @param name the location of the image, relative to the ! * {@code url} argument. * @return the image at the specified URL. * @see java.awt.Image */ public Image getImage(URL url, String name) { try {
*** 313,324 **** public static final AudioClip newAudioClip(URL url) { return new sun.applet.AppletAudioClip(url); } /** ! * Returns the <code>AudioClip</code> object specified by the ! * <code>URL</code> argument. * <p> * This method always returns immediately, whether or not the audio * clip exists. When this applet attempts to play the audio clip, the * data will be loaded. * --- 313,324 ---- public static final AudioClip newAudioClip(URL url) { return new sun.applet.AppletAudioClip(url); } /** ! * Returns the {@code AudioClip} object specified by the ! * {@code URL} argument. * <p> * This method always returns immediately, whether or not the audio * clip exists. When this applet attempts to play the audio clip, the * data will be loaded. *
*** 329,349 **** public AudioClip getAudioClip(URL url) { return getAppletContext().getAudioClip(url); } /** ! * Returns the <code>AudioClip</code> object specified by the ! * <code>URL</code> and <code>name</code> arguments. * <p> * This method always returns immediately, whether or not the audio * clip exists. When this applet attempts to play the audio clip, the * data will be loaded. * * @param url an absolute URL giving the base location of the * audio clip. * @param name the location of the audio clip, relative to the ! * <code>url</code> argument. * @return the audio clip at the specified URL. * @see java.applet.AudioClip */ public AudioClip getAudioClip(URL url, String name) { try { --- 329,349 ---- public AudioClip getAudioClip(URL url) { return getAppletContext().getAudioClip(url); } /** ! * Returns the {@code AudioClip} object specified by the ! * {@code URL} and {@code name} arguments. * <p> * This method always returns immediately, whether or not the audio * clip exists. When this applet attempts to play the audio clip, the * data will be loaded. * * @param url an absolute URL giving the base location of the * audio clip. * @param name the location of the audio clip, relative to the ! * {@code url} argument. * @return the audio clip at the specified URL. * @see java.applet.AudioClip */ public AudioClip getAudioClip(URL url, String name) { try {
*** 353,367 **** } } /** * Returns information about this applet. An applet should override ! * this method to return a <code>String</code> containing information * about the author, version, and copyright of the applet. * <p> * The implementation of this method provided by the ! * <code>Applet</code> class returns <code>null</code>. * * @return a string containing information about the author, version, and * copyright of the applet. */ public String getAppletInfo() { --- 353,367 ---- } } /** * Returns information about this applet. An applet should override ! * this method to return a {@code String} containing information * about the author, version, and copyright of the applet. * <p> * The implementation of this method provided by the ! * {@code Applet} class returns {@code null}. * * @return a string containing information about the author, version, and * copyright of the applet. */ public String getAppletInfo() {
*** 386,410 **** } /** * Returns information about the parameters that are understood by * this applet. An applet should override this method to return an ! * array of <code>Strings</code> describing these parameters. * <p> * Each element of the array should be a set of three ! * <code>Strings</code> containing the name, the type, and a * description. For example: * <blockquote><pre> * String pinfo[][] = { * {"fps", "1-10", "frames per second"}, * {"repeat", "boolean", "repeat image loop"}, * {"imgs", "url", "images directory"} * }; * </pre></blockquote> * <p> * The implementation of this method provided by the ! * <code>Applet</code> class returns <code>null</code>. * * @return an array describing the parameters this applet looks for. */ public String[][] getParameterInfo() { return null; --- 386,410 ---- } /** * Returns information about the parameters that are understood by * this applet. An applet should override this method to return an ! * array of {@code Strings} describing these parameters. * <p> * Each element of the array should be a set of three ! * {@code Strings} containing the name, the type, and a * description. For example: * <blockquote><pre> * String pinfo[][] = { * {"fps", "1-10", "frames per second"}, * {"repeat", "boolean", "repeat image loop"}, * {"imgs", "url", "images directory"} * }; * </pre></blockquote> * <p> * The implementation of this method provided by the ! * {@code Applet} class returns {@code null}. * * @return an array describing the parameters this applet looks for. */ public String[][] getParameterInfo() { return null;
*** 428,438 **** * relative to it. Nothing happens if the audio clip cannot be found. * * @param url an absolute URL giving the base location of the * audio clip. * @param name the location of the audio clip, relative to the ! * <code>url</code> argument. */ public void play(URL url, String name) { AudioClip clip = getAudioClip(url, name); if (clip != null) { clip.play(); --- 428,438 ---- * relative to it. Nothing happens if the audio clip cannot be found. * * @param url an absolute URL giving the base location of the * audio clip. * @param name the location of the audio clip, relative to the ! * {@code url} argument. */ public void play(URL url, String name) { AudioClip clip = getAudioClip(url, name); if (clip != null) { clip.play();
*** 440,459 **** } /** * Called by the browser or applet viewer to inform * this applet that it has been loaded into the system. It is always ! * called before the first time that the <code>start</code> method is * called. * <p> ! * A subclass of <code>Applet</code> should override this method if * it has initialization to perform. For example, an applet with ! * threads would use the <code>init</code> method to create the ! * threads and the <code>destroy</code> method to kill them. * <p> * The implementation of this method provided by the ! * <code>Applet</code> class does nothing. * * @see java.applet.Applet#destroy() * @see java.applet.Applet#start() * @see java.applet.Applet#stop() */ --- 440,459 ---- } /** * Called by the browser or applet viewer to inform * this applet that it has been loaded into the system. It is always ! * called before the first time that the {@code start} method is * called. * <p> ! * A subclass of {@code Applet} should override this method if * it has initialization to perform. For example, an applet with ! * threads would use the {@code init} method to create the ! * threads and the {@code destroy} method to kill them. * <p> * The implementation of this method provided by the ! * {@code Applet} class does nothing. * * @see java.applet.Applet#destroy() * @see java.applet.Applet#start() * @see java.applet.Applet#stop() */
*** 461,489 **** } /** * Called by the browser or applet viewer to inform * this applet that it should start its execution. It is called after ! * the <code>init</code> method and each time the applet is revisited * in a Web page. * <p> ! * A subclass of <code>Applet</code> should override this method if * it has any operation that it wants to perform each time the Web * page containing it is visited. For example, an applet with ! * animation might want to use the <code>start</code> method to ! * resume animation, and the <code>stop</code> method to suspend the * animation. * <p> ! * Note: some methods, such as <code>getLocationOnScreen</code>, can only * provide meaningful results if the applet is showing. Because ! * <code>isShowing</code> returns <code>false</code> when the applet's ! * <code>start</code> is first called, methods requiring ! * <code>isShowing</code> to return <code>true</code> should be called from ! * a <code>ComponentListener</code>. * <p> * The implementation of this method provided by the ! * <code>Applet</code> class does nothing. * * @see java.applet.Applet#destroy() * @see java.applet.Applet#init() * @see java.applet.Applet#stop() * @see java.awt.Component#isShowing() --- 461,489 ---- } /** * Called by the browser or applet viewer to inform * this applet that it should start its execution. It is called after ! * the {@code init} method and each time the applet is revisited * in a Web page. * <p> ! * A subclass of {@code Applet} should override this method if * it has any operation that it wants to perform each time the Web * page containing it is visited. For example, an applet with ! * animation might want to use the {@code start} method to ! * resume animation, and the {@code stop} method to suspend the * animation. * <p> ! * Note: some methods, such as {@code getLocationOnScreen}, can only * provide meaningful results if the applet is showing. Because ! * {@code isShowing} returns {@code false} when the applet's ! * {@code start} is first called, methods requiring ! * {@code isShowing} to return {@code true} should be called from ! * a {@code ComponentListener}. * <p> * The implementation of this method provided by the ! * {@code Applet} class does nothing. * * @see java.applet.Applet#destroy() * @see java.applet.Applet#init() * @see java.applet.Applet#stop() * @see java.awt.Component#isShowing()
*** 496,535 **** * Called by the browser or applet viewer to inform * this applet that it should stop its execution. It is called when * the Web page that contains this applet has been replaced by * another page, and also just before the applet is to be destroyed. * <p> ! * A subclass of <code>Applet</code> should override this method if * it has any operation that it wants to perform each time the Web * page containing it is no longer visible. For example, an applet ! * with animation might want to use the <code>start</code> method to ! * resume animation, and the <code>stop</code> method to suspend the * animation. * <p> * The implementation of this method provided by the ! * <code>Applet</code> class does nothing. * * @see java.applet.Applet#destroy() * @see java.applet.Applet#init() */ public void stop() { } /** * Called by the browser or applet viewer to inform * this applet that it is being reclaimed and that it should destroy ! * any resources that it has allocated. The <code>stop</code> method ! * will always be called before <code>destroy</code>. * <p> ! * A subclass of <code>Applet</code> should override this method if * it has any operation that it wants to perform before it is * destroyed. For example, an applet with threads would use the ! * <code>init</code> method to create the threads and the ! * <code>destroy</code> method to kill them. * <p> * The implementation of this method provided by the ! * <code>Applet</code> class does nothing. * * @see java.applet.Applet#init() * @see java.applet.Applet#start() * @see java.applet.Applet#stop() */ --- 496,535 ---- * Called by the browser or applet viewer to inform * this applet that it should stop its execution. It is called when * the Web page that contains this applet has been replaced by * another page, and also just before the applet is to be destroyed. * <p> ! * A subclass of {@code Applet} should override this method if * it has any operation that it wants to perform each time the Web * page containing it is no longer visible. For example, an applet ! * with animation might want to use the {@code start} method to ! * resume animation, and the {@code stop} method to suspend the * animation. * <p> * The implementation of this method provided by the ! * {@code Applet} class does nothing. * * @see java.applet.Applet#destroy() * @see java.applet.Applet#init() */ public void stop() { } /** * Called by the browser or applet viewer to inform * this applet that it is being reclaimed and that it should destroy ! * any resources that it has allocated. The {@code stop} method ! * will always be called before {@code destroy}. * <p> ! * A subclass of {@code Applet} should override this method if * it has any operation that it wants to perform before it is * destroyed. For example, an applet with threads would use the ! * {@code init} method to create the threads and the ! * {@code destroy} method to kill them. * <p> * The implementation of this method provided by the ! * {@code Applet} class does nothing. * * @see java.applet.Applet#init() * @see java.applet.Applet#start() * @see java.applet.Applet#stop() */
*** 559,569 **** return accessibleContext; } /** * This class implements accessibility support for the ! * <code>Applet</code> class. It provides an implementation of the * Java Accessibility API appropriate to applet user-interface elements. * @since 1.3 */ protected class AccessibleApplet extends AccessibleAWTPanel { --- 559,569 ---- return accessibleContext; } /** * This class implements accessibility support for the ! * {@code Applet} class. It provides an implementation of the * Java Accessibility API appropriate to applet user-interface elements. * @since 1.3 */ protected class AccessibleApplet extends AccessibleAWTPanel {
< prev index next >