Class hamlet.AppFrame
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class hamlet.AppFrame

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----hamlet.AppFrame

public class AppFrame
extends Frame
This class should be the superclass of all applications intended to be displayed via the AppButton applet and messaged via the SendButton applet. An AppFrame provides a frame with a menu bar in which the application can run. The menu bar contains File and Help menus.

The File menu provides three options: Reset, Hide, and Quit. Reset invokes the reset method (which by default does nothing), Hide removes the frame from the display, and Quit removes the frame from the display and from the AppButton registry.

The Help menu provides one option, With Applet, which provides help for the application.

AppFrame objects provide one additional service. Messages that are sent via SendButton are intercepted and passed to the handleMessage method, which by default does nothing.

Every subclass needs to customize several variables and methods, as documented below.

See Also:
AppButton, SendButton

Variable Index

 o helpMenu
Additional entries can be added to helpMenu via Menu.add
 o helpText
Appropriate help text should be assigned to this variable
 o menuBar
Additional entries can be added to menuBar via MenuBar.add

Constructor Index

 o AppFrame()
Sets up the default menus.

Method Index

 o action(Event, Object)
Handles the four default menu entries.
 o handleMessage(String)
This is called whenever a SendButton message is sent.
 o reset()
Resets the application to its initial state.

Variables

 o helpText
  protected static String helpText
Appropriate help text should be assigned to this variable
 o menuBar
  protected MenuBar menuBar
Additional entries can be added to menuBar via MenuBar.add
 o helpMenu
  protected Menu helpMenu
Additional entries can be added to helpMenu via Menu.add

Constructors

 o AppFrame
  public AppFrame()
Sets up the default menus. The constructor for the subclass can add custom menus to the menu bar.

Methods

 o reset
  public void reset()
Resets the application to its initial state. This is called when the Reset menu item is selected. It should be overridden to do something reasonable.
 o handleMessage
  protected void handleMessage(String msg)
This is called whenever a SendButton message is sent. It should be overriden to do something reasonable.
Parameters:
msg - The message from the SendButton
 o action
  public boolean action(Event theEvent,
                        Object arg)
Handles the four default menu entries. If this is overridden to handle other menu entries or controls, the first statement should be
  if (super.action(theEvent, arg)) return(true);
Parameters:
theEvent - Event that triggered the action
arg - Argument associated with the event
Returns:
True if event handled, false otherwise
Overrides:
action in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index