|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.6.0
Package javax.swing.plaf.synthSynth is a skinnable look and feel in which all painting is delegated.
See:
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
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 Synth
Each
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(MyClass.class.getResourceAsStream("laf.xml"), MyClass.class);
UIManager.setLookAndFeel(laf);
Many
Many of the Synth methods take a
All text rendering by non- Notes on specific componentsJTree
Synth provides a region for the cells of a tree:
<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 JTableThe 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"/>
Copyright 2003 Sun Microsystems, Inc. All rights reserved
|
||||||||||||||||||||||