Package javax. swing. plaf. synth
See: Description
-
Interface Summary Interface Description SynthConstants Constants used by Synth.SynthUI SynthUI is used to fetch the SynthContext for a particular Component. -
Class Summary Class Description ColorType A typesafe enumeration of colors that can be fetched from a style.Region A distinct rendering area of a Swing component.SynthButtonUI Provides the Synth L&F UI delegate forJButton
.SynthCheckBoxMenuItemUI Provides the Synth L&F UI delegate forJCheckBoxMenuItem
.SynthCheckBoxUI Provides the Synth L&F UI delegate forJCheckBox
.SynthColorChooserUI Provides the Synth L&F UI delegate forJColorChooser
.SynthComboBoxUI Provides the Synth L&F UI delegate forJComboBox
.SynthContext An immutable transient object containing contextual information about aRegion
.SynthDesktopIconUI Provides the Synth L&F UI delegate for a minimized internal frame on a desktop.SynthDesktopPaneUI Provides the Synth L&F UI delegate forJDesktopPane
.SynthEditorPaneUI Provides the Synth L&F UI delegate forJEditorPane
.SynthFormattedTextFieldUI Provides the Synth L&F UI delegate forJFormattedTextField
.SynthGraphicsUtils Wrapper for primitive graphics calls.SynthInternalFrameUI Provides the Synth L&F UI delegate forJInternalFrame
.SynthLabelUI Provides the Synth L&F UI delegate forJLabel
.SynthListUI Provides the Synth L&F UI delegate forJList
.SynthLookAndFeel SynthLookAndFeel provides the basis for creating a customized look and feel.SynthMenuBarUI Provides the Synth L&F UI delegate forJMenuBar
.SynthMenuItemUI Provides the Synth L&F UI delegate forJMenuItem
.SynthMenuUI Provides the Synth L&F UI delegate forJMenu
.SynthOptionPaneUI Provides the Synth L&F UI delegate forJOptionPane
.SynthPainter SynthPainter
is used for painting portions ofJComponent
s.SynthPanelUI Provides the Synth L&F UI delegate forJPanel
.SynthPasswordFieldUI Provides the Synth L&F UI delegate forJPasswordField
.SynthPopupMenuUI Provides the Synth L&F UI delegate forJPopupMenu
.SynthProgressBarUI Provides the Synth L&F UI delegate forJProgressBar
.SynthRadioButtonMenuItemUI Provides the Synth L&F UI delegate forJRadioButtonMenuItem
.SynthRadioButtonUI Provides the Synth L&F UI delegate forJRadioButton
.SynthRootPaneUI Provides the Synth L&F UI delegate forJRootPane
.SynthScrollBarUI Provides the Synth L&F UI delegate forJScrollBar
.SynthScrollPaneUI Provides the Synth L&F UI delegate forJScrollPane
.SynthSeparatorUI Provides the Synth L&F UI delegate forJSeparator
.SynthSliderUI Provides the Synth L&F UI delegate forJSlider
.SynthSpinnerUI Provides the Synth L&F UI delegate forJSpinner
.SynthSplitPaneUI Provides the Synth L&F UI delegate forJSplitPane
.SynthStyle SynthStyle
is a set of style properties.SynthStyleFactory Factory used for obtainingSynthStyle
s.SynthTabbedPaneUI Provides the Synth L&F UI delegate forJTabbedPane
.SynthTableHeaderUI Provides the Synth L&F UI delegate forJTableHeader
.SynthTableUI Provides the Synth L&F UI delegate forJTable
.SynthTextAreaUI Provides the look and feel for a plain text editor in the Synth look and feel.SynthTextFieldUI Provides the Synth L&F UI delegate forJTextField
.SynthTextPaneUI Provides the look and feel for a styled text editor in the Synth look and feel.SynthToggleButtonUI Provides the Synth L&F UI delegate forJToggleButton
.SynthToolBarUI Provides the Synth L&F UI delegate forJToolBar
.SynthToolTipUI Provides the Synth L&F UI delegate forJToolTip
.SynthTreeUI Provides the Synth L&F UI delegate forJTree
.SynthViewportUI Provides the Synth L&F UI delegate forJViewport
.
Package javax.swing.plaf.synth Description
Synth is a skinnable look and feel in which all painting is
delegated. Synth does not provide a default look. In
order to use Synth you need to specify a
file, or
provide a 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
.
Synth
Each ComponentUI
implementation in Synth associates
itself with one SynthStyle
per Region
, most
Components
only have one Region
and
therefor only one SynthStyle
.
SynthStyle
is used to access all style related properties: fonts, colors
and other Component
properties. In addition
SynthStyle
s are used to obtain
SynthPainter
s for painting the background, border,
focus and other portions of a Component
. The ComponentUI
s obtain
SynthStyle
s from a
SynthStyleFactory
.
A SynthStyleFactory
can be provided directly by way of
SynthLookAndFeel.setStyleFactory(javax.swing.plaf.synth.SynthStyleFactory)
,
or indirectly by way of
SynthLookAndFeel.load(java.io.InputStream, java.lang.Class<?>)
. 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 JComponent
s are broken down into smaller
pieces and identified by the type safe enumeration in
Region
. For example, a JTabbedPane
consists of a Region
for the
JTabbedPane
(Region.TABBED_PANE
), the content
area (Region.TABBED_PANE_CONTENT
), the
area behind the tabs (Region.TABBED_PANE_TAB_AREA
), and the
tabs (Region.TABBED_PANE_TAB
). 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 SynthContext
. This
is used to provide information about the current
Component
and includes: the
SynthStyle
associated with the current
Region
, the state of the Component
as a bitmask (refer to SynthConstants
for the valid
states), and a Region
identifying the portion of
the Component
being painted.
All text rendering by non-JTextComponent
s is
delegated to a SynthGraphicsUtils
, which is
obtained using the SynthStyle
method
SynthStyle.getGraphicsUtils(javax.swing.plaf.synth.SynthContext)
. You can
customize text rendering
by supplying your own SynthGraphicsUtils
.
Notes on specific components
JTree
Synth provides a region for the cells of a tree:
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"/>
JList and JTable
The colors that the renderers for JList and JTable use are specified by way of the list and table Regions. The following XML fragment illustrates how to specify red on white, when selected, and white on red when not selected:
<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"/>
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/plaf/synth/package-summary.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.