Synth Look And Feel
   HOME

TheInfoList



OR:

synth is a skinnable
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
look and feel In software design, the look and feel of a graphical user interface comprises aspects of its design, including elements such as colors, shapes, layout, and typefaces (the "look"), as well as the behavior of dynamic elements such as buttons, boxes ...
, which is configured with an
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
property file. According to Sun, goals for synth were: * Enable to create custom look without writing any code. * Allow appearance to be configured from images. * Provide the ability to customize the look of a component based on its named properties. * Provide a centralized point for overriding the look of all components. * Enable custom rendering based on images, or user-defined s.


History

synth is available beginning with version J2SE 5.0 of Java (see
Java version history The Java language has undergone several changes since JDK 1.0 as well as numerous additions of classes and packages to the standard library. Since J2SE 1.4, the evolution of the Java language has been governed by the Java Community P ...
). Java SE 6 Update 10 release and newer contain ''Nimbus'', a cross-platform Look and Feel implemented with Synth. However, for backwards compatibility, Metal is still the default Swing look and feel.


Architecture

Synth is a skinnable look and feel in which all painting is delegated to the components, without having to write any code (see ). However synth does not provide a default look, and components that are not defined in the synth
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
file will not be painted. It is however possible to assign a default style to all other widgets, and customize styles for some specific widgets only.


Example

The following XML declaration defines a style named textfield and binds it to all text fields. The ''defaultStyle'' allows to set a default font, foreground and background colors to all other widgets. Supposing that the XML declaration is defined in a file named ''synthExample.xml'', the following code loads the XML definition file and sets the current look and feel to synth (loading a synth Look and Feel is done using the ''load'' method of the class): SynthLookAndFeel laf = new SynthLookAndFeel(); laf.load(new File("synthExample.xml").toURI().toURL()); UIManager.setLookAndFeel(laf);


See also

* Swing, the standard cross-platform
widget toolkit A widget toolkit, widget library, GUI toolkit, or UX library is a library (computing), library or a collection of libraries containing a set of graphical control elements (called ''widgets'') used to construct the graphical user interface (GUI) of ...
for Java *
Pluggable look and feel Pluggable look and feel is a mechanism used in the Java Swing widget toolkit allowing to change the look and feel of the graphical user interface at runtime. Swing allows an application to specialize the look and feel of widgets by modifying the ...


References


External links

* API documentation
synth file format

synth tutorial

another synth tutorial

nimbus home page
Widget toolkits JDK components {{compu-library-stub