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
public void setApplication(Application application)
- Sets the Applet's Application.
public Application application()
- Returns the Applet's Application.
- See Also:
- setApplication
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
public void run()
- Creates the Application in the main Application thread.
You should never call this method.
public void start()
- Starts the Applet.
- Overrides:
- start in class Applet
public void stop()
- Stops the Applet.
- Overrides:
- stop in class Applet
public void destroy()
- Destroys the Applet.
- Overrides:
- destroy in class Applet
public void layout()
- Overridden to properly layout the Applet.
- Overrides:
- layout in class Container
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);
}
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
public FoundationPanel panel()
- Returns the FoundationPanel the Applet is using to display its
RootView.
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 places 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
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
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997