The generic button behavior is taken care of by the event dispatcher
and the event handling methods in the Button
class.
The AWT contains the classes Toolkit
and ButtonPeer
for getting the GUI component on the screen in the style that is common for
the platform (Motif-, Macintosh-, or Windows NT-style).
Toolkit
is an abstract class (i.e., without
implementations of most methods) that describes the placement of a
component in an applet: in our example, Toolkit.createButton
is
the name of the method for creating a button. It is actually the browser
or appletviewer that implements the methods promised in
the Toolkit
class.
The way a button really looks like on the screen is determined by the
implementation provided by the browser or appletviewer for the
ButtonPeer
interface. With every GUI component is associated a
peer that determines the look of the component. The AWT subpackage
peer
contains all peers and it is the browser or appletviewer
again that really implements the methods
When building up a user interface, you should not deal with the platform-specific details, but instead focus on the generic behavior and design of your interface.