javax.swing.plaf.synth.SynthStyleFactory . Both configuration options
require an understanding of the synth architecture, which is described below,
as well as an understanding of Swing's architecture.
Unless otherwise specified null is not a legal value to any of the methods
defined in the synth package and if passed in will result in a
NullPointerException.
javax.swing.plaf.ComponentUI implementation in Synth associates
itself with one javax.swing.plaf.synth.SynthStyle per
javax.swing.plaf.synth.Region , most Components only have one
Region and therefore only one SynthStyle. SynthStyle
is used to access all style related properties: fonts, colors
and other Component properties. In addition SynthStyles are
used to obtain javax.swing.plaf.synth.SynthPainter s for painting the
background, border, focus and other portions of a Component. The
ComponentUIs obtain SynthStyles from a
javax.swing.plaf.synth.SynthStyleFactory . A SynthStyleFactory
can be provided directly by way of
javax.swing.plaf.synth.SynthLookAndFeel#setStyleFactory(javax.swing.plaf.synth.SynthStyleFactory) ,
or indirectly by way of javax.swing.plaf.synth.SynthLookAndFeel#load .
The following example uses the SynthLookAndFeel.load() method to
configure a SynthLookAndFeel and sets it as the current look and
feel:
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(MyClass.class.getResourceAsStream("laf.xml"), MyClass.class);
UIManager.setLookAndFeel(laf);
Many JComponents are broken down into smaller pieces and identified
by the type safe enumeration in javax.. For
example, a JTabbedPane consists of a Region for the
JTabbedPane(javax.), the
content area (javax.), the
area behind the tabs
(javax.), and the tabs
(javax.). Each
Region of each JComponent will have a SynthStyle.
This allows you to customize individual pieces of each region of each
JComponent.
Many of the Synth methods take a javax..
This is used to provide information about the current Component and
includes: the javax. associated with the
current javax., the state of the
Component as a bitmask (refer to
javax. for the valid states), and a
javax. identifying the portion of the
Component being painted.
All text rendering by non-JTextComponents is delegated to a
javax., which is obtained using
the javax. method
javax.. You can customize
text rendering by supplying your own
javax..
Region.TREE_CELL. To specify the colors of the
renderer you'll want to provide a style for the
TREE_CELL region. The following illustrates this:
<style id="treeCellStyle">
<opaque value="TRUE"/>
<state>
<color value="WHITE" type="TEXT_FOREGROUND"/>
<color value="RED" type="TEXT_BACKGROUND"/>
</state>
<state value="SELECTED">
<color value="RED" type="TEXT_FOREGROUND"/>
<color value="WHITE" type="BACKGROUND"/>
</state>
</style>
<bind style="treeCellStyle" type="region" key="TreeCell"/>
This specifies a color combination of red on white, when selected, and white on red when not selected. To see the background you need to specify that labels are not opaque. The following XML fragment does that:
<style id="labelStyle">
<opaque value="FALSE"/>
</style>
<bind style="labelStyle" type="region" key="Label"/>
<style id="style">
<opaque value="TRUE"/>
<state>
<color value="WHITE" type="TEXT_FOREGROUND"/>
<color value="RED" type="TEXT_BACKGROUND"/>
<color value="RED" type="BACKGROUND"/>
</state>
<state value="SELECTED">
<color value="RED" type="TEXT_FOREGROUND"/>
<color value="WHITE" type="TEXT_BACKGROUND"/>
</state>
</style>
<bind style="style" type="region" key="Table"/>
<bind style="style" type="region" key="List"/>
| Modifier and Type | Interface and Description |
|---|---|
| public interface | SynthConstants
Constants used by Synth. |
| public interface | SynthIcon
An icon that is passed a |
| public interface | SynthUI
SynthUI is used to fetch the SynthContext for a particular Component. |
| Modifier and Type | Class and Description |
|---|---|
| public class | ColorType
A typesafe enumeration of colors that can be fetched from a style. |
| pack-priv class | DefaultSynthStyleFactory
Factory used for obtaining styles. |
| pack-priv class | ImagePainter
ImagePainter fills in the specified region using an Image. |
| pack-priv class | ParsedSynthStyle
ParsedSynthStyle are the SynthStyle's that SynthParser creates. |
| public class | Region
A distinct rendering area of a Swing component. |
| pack-priv class | SynthArrowButton
JButton object that draws a scaled Arrow in one of the cardinal directions. |
| pack-priv class | SynthBorder
SynthBorder is a border that delegates to a Painter. |
| public class | SynthButtonUI
Provides the Synth L&F UI delegate for
|
| public class | SynthCheckBoxMenuItemUI
Provides the Synth L&F UI delegate for
|
| public class | SynthCheckBoxUI
Provides the Synth L&F UI delegate for
|
| public class | SynthColorChooserUI
Provides the Synth L&F UI delegate for
|
| public class | SynthComboBoxUI
Provides the Synth L&F UI delegate for
|
| pack-priv class | SynthComboPopup
Synth's ComboPopup. |
| public class | SynthContext
An immutable transient object containing contextual information about
a |
| pack-priv class | SynthDefaultLookup
SynthDefaultLookup redirects all lookup calls to the SynthContext. |
| public class | SynthDesktopIconUI
Provides the Synth L&F UI delegate for a minimized internal frame on a desktop. |
| public class | SynthDesktopPaneUI
Provides the Synth L&F UI delegate for
|
| public class | SynthEditorPaneUI
Provides the Synth L&F UI delegate for
|
| public class | SynthFormattedTextFieldUI
Provides the Synth L&F UI delegate for
|
| public class | SynthGraphicsUtils
Wrapper for primitive graphics calls. |
| pack-priv class | SynthInternalFrameTitlePane
The class that manages a synth title bar |
| public class | SynthInternalFrameUI
Provides the Synth L&F UI delegate for
|
| public class | SynthLabelUI
Provides the Synth L&F UI delegate for
|
| public class | SynthListUI
Provides the Synth L&F UI delegate for
|
| public class | SynthLookAndFeel
SynthLookAndFeel provides the basis for creating a customized look and feel. |
| public class | SynthMenuBarUI
Provides the Synth L&F UI delegate for
|
| pack-priv class | SynthMenuItemLayoutHelper
Calculates preferred size and layouts synth menu items. |
| public class | SynthMenuItemUI
Provides the Synth L&F UI delegate for
|
| pack-priv class | SynthMenuLayout
The default layout manager for Popup menus and menubars. |
| public class | SynthMenuUI
Provides the Synth L&F UI delegate for
|
| public class | SynthOptionPaneUI
Provides the Synth L&F UI delegate for
|
| public abstract class | SynthPainter
|
| public class | SynthPanelUI
Provides the Synth L&F UI delegate for
|
| pack-priv class | |
| public class | SynthPasswordFieldUI
Provides the Synth L&F UI delegate for
|
| public class | SynthPopupMenuUI
Provides the Synth L&F UI delegate for
|
| public class | SynthProgressBarUI
Provides the Synth L&F UI delegate for
|
| public class | SynthRadioButtonMenuItemUI
Provides the Synth L&F UI delegate for
|
| public class | SynthRadioButtonUI
Provides the Synth L&F UI delegate for
|
| public class | SynthRootPaneUI
Provides the Synth L&F UI delegate for
|
| public class | SynthScrollBarUI
Provides the Synth L&F UI delegate for
|
| public class | SynthScrollPaneUI
Provides the Synth L&F UI delegate for
|
| public class | SynthSeparatorUI
Provides the Synth L&F UI delegate for
|
| public class | SynthSliderUI
Provides the Synth L&F UI delegate for
|
| public class | SynthSpinnerUI
Provides the Synth L&F UI delegate for
|
| pack-priv class | SynthSplitPaneDivider
Synth's SplitPaneDivider. |
| public class | SynthSplitPaneUI
Provides the Synth L&F UI delegate for
|
| public abstract class | SynthStyle
|
| public abstract class | SynthStyleFactory
Factory used for obtaining |
| public class | SynthTabbedPaneUI
Provides the Synth L&F UI delegate for
|
| public class | SynthTableHeaderUI
Provides the Synth L&F UI delegate for
|
| public class | SynthTableUI
Provides the Synth L&F UI delegate for
|
| public class | SynthTextAreaUI
Provides the look and feel for a plain text editor in the Synth look and feel. |
| public class | SynthTextFieldUI
Provides the Synth L&F UI delegate for |
| public class | SynthTextPaneUI
Provides the look and feel for a styled text editor in the Synth look and feel. |
| public class | SynthToggleButtonUI
Provides the Synth L&F UI delegate for
|
| public class | SynthToolBarUI
Provides the Synth L&F UI delegate for
|
| public class | SynthToolTipUI
Provides the Synth L&F UI delegate for
|
| public class | SynthTreeUI
Provides the Synth L&F UI delegate for
|
| public class | SynthViewportUI
Provides the Synth L&F UI delegate for
|