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