JButton is the simplest of the button types, adding very little
to what is provided by the
JButtons are buttons that are not toggled on
and off but instead act as push buttons, which invoke some action when clicked. Figure 5-2 shows what these buttons
look like in four of the Swing L&Fs.
Figure 5-2. JButtons in four L&Fs
JButton class inherits
most of its properties and default values from its superclasses. The
exceptions to this are shown in Table 5-9. The
model property is set to a new instance of
DefaultButtonModel when a
JButton is created.
Table 5-9. JButton properties
See also properties from
defaultButton property indicates whether the button is activated by
default when some event occurs within the
JRootPane containing the button. Typically,
the event that would trigger the button would be an Enter key press,
but this is actually up to the L&F implementation.
cannot be set directly. Instead, it is set by telling the
JRootPane which button should be the
default. (We’ll cover
Chapter 8—at this point, it’s enough ...