Class FoundationApplet
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class FoundationApplet

public class netscape.application.FoundationApplet
    extends java.applet.Applet
    implements java.lang.Runnable
{
    /* Constructors
     */
    public FoundationApplet();

    /* Methods
     */
    public Application application();
    public Class classForName(String);
    protected FoundationPanel createPanel();
    public void destroy();
    public void init();
    public void layout();
    public FoundationPanel panel();
    public void popIFCContext();
    public Application pushIFCContext();
    public void run();
    public void setApplication(Application);
    public void start();
    public void stop();
}
java.applet.Applet subclass that attaches a FoundationPanel instance to the Java Applet. Each Application has a FoundationApplet instance, although you will never access it directly.

Constructors

FoundationApplet

  public FoundationApplet()
Constructs a new FoundationApplet.

Methods

setApplication

  public void setApplication(Application application)
Sets the Applet's Application.

application

  public Application application()
Returns the Applet's Application.
See Also:
setApplication

init

  public void init()
Initializes the FoundationApplet instance. Also creates the Application object and starts a new thread for it to run in. You should never call this method.
Overrides:
init in class Applet

run

  public void run()
Creates the Application in the main Application thread. You should never call this method.

start

  public void start()
Starts the Applet.
Overrides:
start in class Applet

stop

  public void stop()
Stops the Applet.
Overrides:
stop in class Applet

destroy

  public void destroy()
Destroys the Applet.
Overrides:
destroy in class Applet

layout

  public void layout()
Overridden to properly layout the Applet.
Overrides:
layout in class Container

classForName

  public Class classForName(String className) throws ClassNotFoundException
This method must be implemented by the Applet developer because there is no way in the standard Java API for system classes (such as, netscape.application) to look up an Applet's class by name. The static method Class.forName() simply looks up one level in the stack and gets the ClassLoader associated with the method block of the caller. When the netscape.application classes are installed as system classes, the ClassLoader is null. Thus, when code in netscape.application calls Class.forName() it can only find other system classes.

The solution is an API that allows code to find the ClassLoader for an applet by URL, and public API on ClassLoader to ask it to load classes by name. Until these enhancements can be made and distributed to all the world's Java systems, Applets must subclass FoundationApplet and implement the following one-line method:

    public abstract Class classForName(String className)
        throws ClassNotFoundException {
        return Class.forName(className);
    }

createPanel

  protected FoundationPanel createPanel()
Creates and returns the Applet's FoundationPanel. FoundationApplet subclasses can override this method to provide a custom FoundationPanel subclass.
See Also:
FoundationPanel

panel

  public FoundationPanel panel()
Returns the FoundationPanel the Applet is using to display its RootView.

pushIFCContext

  public Application pushIFCContext()
Any JavaScript function that sends message to an IFC-based Applet must call this method before sending any messages. Returns the Application. The JavaScript function must generate a corresponding popIFCContext() call. This method placeds the Application object on a stack, so the IFC can properly determine which Application is running when the JavaScript method executes. Failure to call popIFCContext() after the JavaScript finishes may result in the Application not being properly garbage collected. Here's a simple JavaScript example:
 <SCRIPT>
  function sendToFront() {
    SimpleDrawApp = document.applets[0].pushIFCContext();
    SimpleDrawApp.drawController.moveToFront();
    document.applets[0].popIFCContext();
  }
 </SCRIPT>
Note: This method can only be called from JavaScript code.
See Also:
popIFCContext

popIFCContext

  public void popIFCContext()
Any JavaScript function that sends message to an IFC-based Applet must call this method after sending all messages, to match the previous pushIFCContext() call.

Note: This method can only be called from JavaScript code.

See Also:
pushIFCContext

All Packages  Class Hierarchy  This Package  Previous  Next  Index