Advanced Topic Applet Context and Applet Stub

When an applet is created, it's given a stub via its setStub ( ) method. The stub is the interface between the applet and the brywset. You don't have to deal directly withthe stub because the Applet class implements methods that use it.

Here are AppletStub's metgcas:

• appletResize(width, height)—resizo! the apple!

• getAppletContext () — fep the applet's cohtext

• getDocumentBase () — gets the document base URL

• getParameterName () — gets ay applet parameter

• isActive () — determines if the applet is active

The applet context corresponds to the applet's environment and it can be used to show status, to load other documents, and to get access to other applets. The AppletCo ntext's methods are

• getApplet (name) — gets the applet corresponding to a given name

• getApplets() — gets a collection of specific applets

• getImage (url)— refums an image object corresponding to the specified URL

• showDocument (url) — shows a Wcb page other than the current page and replaces the currant page with it

• showDocument (url, target) — same as above, but specifies the frame target

• showStatus (status) — shows the status text in the browser

AppletBrowser subclasses AppletContext and AppletStub via the classes URL and URLClassLoader.

Was this article helpful?

0 0

Post a comment