Class awtExt.Menu
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class awtExt.Menu

java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuItem
                   |
                   +----java.awt.Menu
                           |
                           +----awtExt.Menu

public class Menu
extends Menu
Extension of standard awt Menu. Provides a callback mechanism for invoking a user defined method, when an ACTION_EVENT occurs within this awtExt component. The called back method and target object must have a specific signature. This allows you to separate your application functionality from the GUI. i.e, no need to subclass the Menu in order to invoke your user defined code.

NOTE: This component does NOT  use the general EventDispatch
mechanism, as the only event of interest is the ACTION_EVENT.
See Also:
Callback, Menu

Constructor Index

 o Menu(String)
Constructor.
 o Menu(String, methodRef)
Constructor.
 o Menu(String, Object, String)
Constructor.

Method Index

 o addActionCallback(methodRef)
Adds a user defined methodRef.
 o handleEvent(Event)
Handles the event.
 o postEvent(Event)
Posts the specified event to the menu.

Constructors

 o Menu
  public Menu(String aLabel)
Constructor. Takes a string as a parameter, to be used as the label.
Parameters:
aLabel - label for the Menu
 o Menu
  public Menu(String aLabel,
              methodRef aMethodRef)
Constructor.
Parameters:
aLabel - label for the Menu
aMethodRef - Fully resolved methodRef, i.e must have its target object set.
See Also:
setTarget
 o Menu
  public Menu(String aLabel,
              Object target,
              String method) throws InvalidMethodRefException
Constructor.
Parameters:
aLabel - label for the Menu
target - object which is target of the called back method
method - string representation of method to invoke on target object.
Throws: InvalidMethodRefException
If generation of callback fails for any reason.

Methods

 o addActionCallback
  public void addActionCallback(methodRef aMethodRef)
Adds a user defined methodRef. This is invoked when an ACTION_EVENT occurs. The methodRef must be defined using the utility class awtExt.Callback
Parameters:
aMethodRef - Fully resolved methodRef, i.e must have the target object set.
See Also:
setTarget, Callback, methodRef
 o postEvent
  public final boolean postEvent(Event evt)
Posts the specified event to the menu. The event will propagate to its menu bar container, if it's not handled in here, or if the CallbackInfo.processed is stays set to false.
Parameters:
evt - the event which is to take place
Overrides:
postEvent in class MenuComponent
See Also:
Callback
 o handleEvent
  public final boolean handleEvent(Event evt)
Handles the event. Invokes user defined method, if there is one. Returns CallbackInfo.processed to control event propagation
Parameters:
evt - the event which is to take place
See Also:
CallbackInfo, processed

All Packages  Class Hierarchy  This Package  Previous  Next  Index