package extensions.awt; import java.awt.*; /** * Delegate Checkbox action event. * * @see java.awt.Checkbox * @see extensions.awt.ActionProtocol * @version 1.0.2 * @author John Webster Small */ public class CheckboxAction extends Checkbox implements ActionProtocol { private ActionProtocol ap; /** Construct a CheckboxAction (i.e. a checkbox) with * the action to be performed when this box is * clicked. The action is performed automatically * only if this CheckboxAction appears within an * FrameExtended or DialogExtended window. * @param ap action to be performed, i.e. run() * @see extensions.awt.FrameExtended * @see extensions.awt.DialogExtended * @see extensions.awt.ActionProtocol * @see extensions.awt.MenuItemAction */ public CheckboxAction(ActionProtocol ap) { super(); this.ap = ap; } /** Label the Checkbox. * @param label Label displayed on button * @param ap action to be performed, i.e. run() */ public CheckboxAction(String label, ActionProtocol ap) { super(label); this.ap = ap; } /** Label the checkbox. * @param label label displayed by checkbox * @param group add to radio checkbox group * @param state initial state of checkbox * @param ap action to be performed, i.e. run() */ public CheckboxAction(String label, CheckboxGroup group, boolean state, ActionProtocol ap) { super(label,group,state); this.ap = ap; } /** Label the checkbox. * @param label label displayed by checkbox * @param group add to radio checkbox group * @param state initial state of checkbox * @param ap action to be performed, i.e. run() */ public CheckboxAction(String label, CheckboxGroupPanel group, boolean state, ActionProtocol ap) { super(label); setState(state); this.ap = ap; group.add(this); } /** Forward the checkbox clicked action event on to * the action for further processing by the application * model rather than the GUI. This method is called * automatically by FrameExtended and DialogExtended. * @param forward the component forwarding action event * @param evt the event that caused the action * @param what the action * @see extensions.awt.ActionProtocol * @see extensions.awt.FrameExtended#handleEvent * @see extensions.awt.DialogExtended#handleEvent */ public final void action(Component forward, Event evt, Object what) { ap.action(forward,evt,what); } }