summaryrefslogtreecommitdiff
path: root/java/apps/NexusII/classes/awtCommand/CButton.java
blob: ff0f3385bad42afe44911a9b7eeddad063d88adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

package awtCommand;

import java.lang.*;
import java.awt.*;

public class CButton extends java.awt.Button {
    protected Command actionCommand = null;

    /**
     * Constructs a CButton.
     */
    public CButton() {
	super();
    }

    /**
     * Constructs a CButton with the given name.
     */
    public CButton(String name) {
	super(name);
    }

   /**
    * Sets the actionCommand object.
    */
    public void setActionCommand(Command action) {
	actionCommand = action;
    }

    /**
     * Called when the button is selected..
     * This results in a call to the actionCommand object 
     * with <code>what</code> set to the button's label.
     */
    public boolean action(Event evt, Object what) {
	if (actionCommand != null)
	    actionCommand.execute(this, evt, what);
	return false;
    }
}