Java Reference
In-Depth Information
);
gui.add(b);
Action events come from the basic action on the component, such as
pressing a button or selecting a check box. The ActionEvent class has de-
tails of an action event, such as the keyboard modifiers (such as the Alt
or Control key) that were being pressed when the action occurred. To
receive this event you must register interest in action events, either by
adding an ActionListener to the component as shown here or by invok-
ing enableEvents with an appropriate mask.
The ActionListener interface in the previous example is a listener in-
terface. Listener interfaces extend java.util.EventListener and exist for
many kinds of events: mouse, keyboard, window, item, text, container,
and general component events. You use objects that implement listener
interfaces to trigger method execution when events occurall of which get
executed by the event thread. When an event occurs, the component's
processEvent method is called, which in turn calls processXXXEvent for the
specific event, and that in turn will call the XXXOccurred method of all re-
gistered listeners for that event.
Other classes in java.awt allow you to set colors, fonts, and so on. All
these properties are inherited by default from outer componentsthe de-
fault colors of a button are those of the frame in which it has been
placed. You can override this setting at any level by explicitly specifying
a color for a component. That component and all its contained compon-
ents will change to the specified color unless a subcomponent has its
color specified.
Various subpackages of java.awt allow you to manipulate images,
sounds, and other media:
java.awt.color color manipulation tools
java.awt.datatransfer moving data between applications, such as
with cut, copy, and paste
 
Search WWH ::




Custom Search