AppletStub Interface
The AppletStub
interface provides a way to get information from the run-time browser environment. The Applet
class provides methods with similar names that call these methods. Methods
- public abstract boolean isActive ()
- The
isActive()
method returns the current state of the applet. While an applet is initializing, it is not active, and calls toisActive()
returnfalse
. The system marks the applet active just prior to callingstart()
; after this point, calls toisActive()
returntrue
. - public abstract URL getDocumentBase ()
- The
getDocumentBase()
method returns the complete URL of the HTML file that loaded the applet. This method can be used with thegetImage()
orgetAudioClip()
methods to load an image or audio file relative to the HTML file. - public abstract URL getCodeBase ()
- The
getCodeBase()
method returns the complete URL of the .class file that contains the applet. This method can be used with thegetImage()
method or thegetAudioClip()
method to load an image or audio file relative to the .class file. - public abstract String getParameter (String name)
- The
getParameter()
method allows you to get parameters from<PARAM>
tags within the<APPLET>
tag of the HTML file that loaded the applet. Thename
parameter ofgetParameter()
must match the name string of the<PARAM>
tag;name
is case insensitive. The return value ofgetParameter()
is the value associated withname
; it is always aString
regardless of the type of data in the tag. Ifname
is not found within the<PARAM>
tags of the<APPLET>
,getParameter()
returnsnull
. - public abstract AppletContext getAppletContext ()
- The
getAppletContext()
method returns the currentAppletContext
of the applet. This is part of the stub that is set by the system whensetStub()
is called. - public abstract void appletResize (int width, int height)
- The
appletResize()
method is called by the resize method of theApplet
class. The method changes the size of the applet space towidth
xheight
. The browser must support changing the applet space; if it doesn't, the size remains unchanged.