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

Class awtExt.Button

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Button
                   |
                   +----awtExt.Button

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

Constructor Index

 o Button()
Default Constructor.
 o Button(String)
Constructor.
 o Button(String, methodRef)
Constructor.
 o Button(String, Object, String)
Constructor.

Method Index

 o action(Event, Object)
Called when an action occurs.
 o addActionCallback(methodRef)
Adds user defined methodRef.

Constructors

 o Button
  public Button()
Default Constructor.
 o Button
  public Button(String aLabel)
Constructor. Takes a string as a parameter, to be used as the label.
Parameters:
aLabel - label for the button
 o Button
  public Button(String aLabel,
                methodRef mr)
Constructor.
Parameters:
aLabel - label for the button
mr - method reference to callbackable method. mr must have the target object set.
See Also:
setTarget
 o Button
  public Button(String aLabel,
                Object target,
                String method) throws InvalidMethodRefException
Constructor.
Parameters:
aLabel - label for the button
target - object which is target of the called back method
method - string representation of method to invoke on target object.
Throws: InvalidMethodRefException
generated if creation of callback fails

Methods

 o addActionCallback
  public void addActionCallback(methodRef aMethodRef)
Adds user defined methodRef. This is invoked when a ACTION_EVENT occurs. The methodRef must be defined using the utility class awtExt.Callback
Parameters:
aMethodRef - ACTION_EVENT event handling method. must have the target object set.
See Also:
setTarget, Callback, methodRef
 o action
  public final boolean action(Event evt,
                              Object obj)
Called when an action occurs. This in turn calls back a user defined method on a target object. The called back method *AND* the target object must have a specific signature. Since the action event for this button is *always* handled here, this action() method returns false to stop the event propagation.
Parameters:
evt - The action event that just occurred.
obj - The label of this object.
Overrides:
action in class Component
See Also:
Callback, CallbackInfo

All Packages  Class Hierarchy  This Package  Previous  Next  Index