A good percentage of AWT components fire some sort of semantic event. Likewise, many custom components perform one or more actions that could be construed as semantic events. Equipping a custom component to fire semantic events is a fairly common and, thankfully, straightforward task that can be enumerated as follows:
Have the component implement a listener interface, if appropriate.
Add an appropriate listener member to the class.
Implement addXXXListener() and removeXXXListener().
Example 9-25 lists the ThreeDButton class modified to fire action events under the same circumstances that java.awt.Button does.
import java.applet.Applet; ...