1. /*
  2. * @(#)AppletStub.java 1.24 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.applet;
  8. import java.net.URL;
  9. /**
  10. * When an applet is first created, an applet stub is attached to it
  11. * using the applet's <code>setStub</code> method. This stub
  12. * serves as the interface between the applet and the browser
  13. * environment or applet viewer environment in which the application
  14. * is running.
  15. *
  16. * @author Arthur van Hoff
  17. * @version 1.24, 01/23/03
  18. * @see java.applet.Applet#setStub(java.applet.AppletStub)
  19. * @since JDK1.0
  20. */
  21. public interface AppletStub {
  22. /**
  23. * Determines if the applet is active. An applet is active just
  24. * before its <code>start</code> method is called. It becomes
  25. * inactive just before its <code>stop</code> method is called.
  26. *
  27. * @return <code>true</code> if the applet is active;
  28. * <code>false</code> otherwise.
  29. */
  30. boolean isActive();
  31. /**
  32. * Gets the URL of the document in which the applet is embedded.
  33. * For example, suppose an applet is contained
  34. * within the document:
  35. * <blockquote><pre>
  36. * http://java.sun.com/products/jdk/1.2/index.html
  37. * </pre></blockquote>
  38. * The document base is:
  39. * <blockquote><pre>
  40. * http://java.sun.com/products/jdk/1.2/index.html
  41. * </pre></blockquote>
  42. *
  43. * @return the {@link java.net.URL} of the document that contains the
  44. * applet.
  45. * @see java.applet.AppletStub#getCodeBase()
  46. */
  47. URL getDocumentBase();
  48. /**
  49. * Gets the base URL. This is the URL of the directory which contains the applet.
  50. *
  51. * @return the base {@link java.net.URL} of
  52. * the directory which contains the applet.
  53. * @see java.applet.AppletStub#getDocumentBase()
  54. */
  55. URL getCodeBase();
  56. /**
  57. * Returns the value of the named parameter in the HTML tag. For
  58. * example, if an applet is specified as
  59. * <blockquote><pre>
  60. * <applet code="Clock" width=50 height=50>
  61. * <param name=Color value="blue">
  62. * </applet>
  63. * </pre></blockquote>
  64. * <p>
  65. * then a call to <code>getParameter("Color")</code> returns the
  66. * value <code>"blue"</code>.
  67. *
  68. * @param name a parameter name.
  69. * @return the value of the named parameter,
  70. * or <tt>null</tt> if not set.
  71. */
  72. String getParameter(String name);
  73. /**
  74. * Gets a handler to the applet's context.
  75. *
  76. * @return the applet's context.
  77. */
  78. AppletContext getAppletContext();
  79. /**
  80. * Called when the applet wants to be resized.
  81. *
  82. * @param width the new requested width for the applet.
  83. * @param height the new requested height for the applet.
  84. */
  85. void appletResize(int width, int height);
  86. }