Java Reference
In-Depth Information
attachedtothecomponentbyinvoking
void setModel(ButtonModel model)
,
which
JButton
inherits from its
javax.swing.AbstractButton
superclass.
JButton
is associated with a UI delegate that's described by the abstract
javax.swing.plaf.ButtonUI
class, which extends the abstract
javax.swing.plaf.ComponentUI
class. Swing attaches the UI delegate to the
component by invoking
void setUI(ButtonUI ui)
, which
JButton
inherits
from
AbstractButton
.
Pluggable Look and Feels
A
look and feel
is a set of UI delegates with one UI delegate per component. For ex-
ample, Swing provides a look and feel for making a Swing GUI look like a Windows
XP GUI. It also provides look and feels that make the GUI look and feel the same re-
gardless of the underlying windowing system.
Swingalsoprovidesamechanismforselectingaspecificlookandfeel.Becausethis
mechanism is used to plug the look and feel into the GUI before the GUI is displayed
(orevenafteritisdisplayed),alookandfeelisalsoknownasa
pluggable look and feel
(PLAF)
.
The following PLAFs are supported:
•
Basic
is an abstract PLAF that serves as the foundation on which the other
PLAFs are based. It's located in the
javax.swing.plaf.basic
package
and its main class is
BasicLookAndFeel
.
•
Metal
is a cross-platform PLAF and is also the default. It's located in the
javax.swing.plaf.metal
package and its main class is
MetalLookAndFeel
.
•
Multi
is a multiplexing PLAF that combines PLAFs. It's located in the
javax.swing.plaf.multi
package and its main class is
MultiLookAndFeel
. (Each multiplexing UI delegate manages its child UI
delegates. Multi was created primarily for use with the Accessibility API.)
•
Nimbus
is a polished cross-platform PLAF that uses Java 2D-based vector
graphicstodrawtheGUIsothatitlookscrispatanyresolution.Nimbusisloc-
ated in the
javax.swing.plaf.nimbus
package; its main class is
Nim-
busLookAndFeel
.
•
Synth
is a skinnable PLAF that's based on an XML file. It's located in the
javax.swing.plaf.synth
package and its main class is
Syn-
thLookAndFeel
.