All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dtai.gwt.AppletManager

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----dtai.gwt.AppletManager

public class AppletManager
extends Frame
implements AppletContext, URLStreamHandlerFactory
AppletManager - implements AppletContext and works with gwt.AppletWrapper to allow any applet to easily run as an application. The only thing it can't do is access URL's. Applet parameters are entered on the command line with name as one word and value as the next, or through an HTML file.


Constructor Index

 o AppletManager()
AppletManager
 o AppletManager(Applet, int, int, int, int, String[])
Convenience constructor for the AppletManager that starts the given applet in its own frame (AppletFrame).
 o AppletManager(Applet, int, int, String[])
Convenience constructor for the AppletManager that starts the given applet in its own frame (AppletFrame).

Method Index

 o add(AppletWrapper)
Add an applet, via an AppletWrapper, and have it initialize.
 o createURLStreamHandler(String)
Creates a new URLStreamHandler instance with the specified protocol.
 o getApplet(String)
Gets an applet by name.
 o getApplets()
Enumerates the applets in this context.
 o getAudioClip(URL)
Gets an audio clip.
 o getDefaultAppletContext()
Return the default applet context.
 o getImage(URL)
Gets an image.
 o getStatusBar()
returns the object in which "showStatus" is displayed
 o remove(AppletWrapper)
Remove an applet, via an AppletWrapper.
 o setStatusBar(TextField)
setStatusBar Set the given TextField as the status bar.
 o setStatusBar(TextFieldGadget)
setStatusBar Set the given TextField as the status bar.
 o showDocument(URL)
Shows a new document.
 o showDocument(URL, String)
Show a new document in a target window or frame.
 o showStatus(String)
Show a status string in the status area (the Text object at the bottom of the window).

Constructors

 o AppletManager
 public AppletManager()
AppletManager

 o AppletManager
 public AppletManager(Applet applet,
                      int defaultWidth,
                      int defaultHeight,
                      String args[])
Convenience constructor for the AppletManager that starts the given applet in its own frame (AppletFrame).

Parameters:
applet - the wrapper of an applet
defaultWidth - default frame width
defaultHeight - default frame height
args - the command line arguments
 o AppletManager
 public AppletManager(Applet applet,
                      int defaultX,
                      int defaultY,
                      int defaultWidth,
                      int defaultHeight,
                      String args[])
Convenience constructor for the AppletManager that starts the given applet in its own frame (AppletFrame).

Parameters:
applet - the wrapper of an applet
defaultX - default frame x
defaultY - default frame y
defaultWidth - default frame width
defaultHeight - default frame height
args - the command line arguments

Methods

 o getDefaultAppletContext
 public static AppletManager getDefaultAppletContext()
Return the default applet context.

Returns:
defaultAppletContext the default applet context, or null if none
 o add
 protected void add(AppletWrapper appletWrapper)
Add an applet, via an AppletWrapper, and have it initialize.

Parameters:
appletWrapper - the wrapper of an applet
 o remove
 protected void remove(AppletWrapper appletWrapper)
Remove an applet, via an AppletWrapper.

Parameters:
appletWrapper - the wrapper of an applet
 o setStatusBar
 public void setStatusBar(TextField status)
setStatusBar Set the given TextField as the status bar.

Parameters:
status - the TextField
 o setStatusBar
 public void setStatusBar(TextFieldGadget status)
setStatusBar Set the given TextField as the status bar.

Parameters:
status - the TextField
 o getStatusBar
 public Object getStatusBar()
returns the object in which "showStatus" is displayed

Returns:
a TextField or TextFieldGadget (must do instanceof to tell)
 o getAudioClip
 public final AudioClip getAudioClip(URL url)
Gets an audio clip. (There doesn't seem to be a "Toolkit" for audio clips in my JDK, so this always returns null. You could implement this differently, returning a dummy AudioClip object for which the class could be defined at the bottom of this file.)

Parameters:
url - URL of the AudioClip to load
Returns:
the AudioClip object if it exists (in our case, this is always null
 o getImage
 public final Image getImage(URL url)
Gets an image. This usually involves downloading it over the net. However, the environment may decide to cache images. This method takes an array of URLs, each of which will be tried until the image is found.

Parameters:
url - URL of the Image to load
Returns:
the Image object
 o getApplet
 public final Applet getApplet(String name)
Gets an applet by name.

Parameters:
name - the name of the applet
Returns:
null if the applet does not exist, and it never does since we never name the applet.
 o getApplets
 public final Enumeration getApplets()
Enumerates the applets in this context. Only applets that are accessible will be returned. This list always includes the applet itself.

Returns:
the Enumeration -- contains ONLY the applet created with this AppletManager
 o showDocument
 public void showDocument(URL url)
Shows a new document. This may be ignored by the applet context (and in our case, it is, but we'll show the user, in the status area, that the document was requested and WOULD be loaded if in a browser).

Parameters:
url - URL to load
 o showDocument
 public void showDocument(URL url,
                          String target)
Show a new document in a target window or frame. This may be ignored by the applet context. (Again, it is ignored, but we'll show the request information to the user in the status area.) This method accepts the target strings: _self show in current frame _parent show in parent frame _top show in top-most frame _blank show in new unnamed top-level window show in new top-level window named

Parameters:
url - URL to load
target - the target string
 o showStatus
 public void showStatus(String text)
Show a status string in the status area (the Text object at the bottom of the window).

Parameters:
text - the text to display
 o createURLStreamHandler
 public URLStreamHandler createURLStreamHandler(String protocol)
Creates a new URLStreamHandler instance with the specified protocol.

Parameters:
protocol - the protocol to use (ftp, http, nntp, etc.). THIS PROTOCOL IS IGNORED BY THIS APPLET CONTEXT
Returns:
URLStreamHandler

All Packages  Class Hierarchy  This Package  Previous  Next  Index