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

Class awtExt.CheckboxMenuItem

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

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

Constructor Index

 o CheckboxMenuItem(String)
Constructor.
 o CheckboxMenuItem(String, methodRef)
Constructor.
 o CheckboxMenuItem(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 checkboxmenuitem.

Constructors

 o CheckboxMenuItem
  public CheckboxMenuItem(String aLabel)
Constructor. Takes a string as a parameter, to be used as the label.
Parameters:
aLabel - label for the CheckboxMenuItem
 o CheckboxMenuItem
  public CheckboxMenuItem(String aLabel,
                          methodRef mr)
Constructor.
Parameters:
aLabel - label for the CheckboxMenuItem
mr - method reference to callbackable method. mr must have the target object set.
See Also:
setTarget
 o CheckboxMenuItem
  public CheckboxMenuItem(String aLabel,
                          Object target,
                          String method) throws InvalidMethodRefException
Constructor.
Parameters:
aLabel - label for the checkboxMenuItem
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

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
See Also:
Callback, methodRef
 o postEvent
  public boolean postEvent(Event evt)
Posts the specified event to the checkboxmenuitem. The event will propagate to its menu 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 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