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

Class awtExt.MenuBar

java.lang.Object
   |
   +----java.awt.MenuComponent
           |
           +----java.awt.MenuBar
                   |
                   +----awtExt.MenuBar

public class MenuBar
extends MenuBar
Extension of standard awt MenuBar. 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 MenuBar 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, MenuBar

Constructor Index

 o MenuBar()
Constructor.
 o MenuBar(methodRef)
Constructor.
 o MenuBar(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 menubar.

Constructors

 o MenuBar
  public MenuBar()
Constructor.
 o MenuBar
  public MenuBar(methodRef mr)
Constructor.
Parameters:
mr - method reference to callbackable method. mr must have the target object set.
See Also:
setTarget
 o MenuBar
  public MenuBar(Object target,
                 String method) throws InvalidMethodRefException
Constructor.
Parameters:
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 a 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:
Callback, methodRef
 o postEvent
  public final boolean postEvent(Event evt)
Posts the specified event to the menubar. The event will propagate to its frame container, if it's not handled in here, or if the CallbackInfo.processed is 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