请输入您要查询的百科知识:

 

词条 Synth Look and Feel
释义

  1. History

  2. Architecture

  3. Example

  4. See also

  5. References

  6. External links

{{multiple issues|{{notability|date=April 2011}}{{Primary sources|date=April 2011}}
}}synth is a skinnable Java look and feel, which is configured with an XML property file.[1]

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 {{Javadoc:SE|javax/swing/plaf/synth|SynthPainter}}s.

History

synth is available beginning with version J2SE 5.0 of Java (see Java version history).[2]

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.[3]

Architecture

Synth is a skinnable look and feel in which all painting is delegated to the components, without having to write any code (see {{Javadoc:SE|name=Synth Look and Feel|javax/swing/plaf/synth}}).[4]

However synth does not provide a default look, and components that are not defined in the synth XML 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 {{Javadoc:SE|javax/swing/plaf/synth|SynthLookAndFeel}} 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 for Java
  • Pluggable look and feel

References

1. ^{{cite web| url=http://www.javadesktop.org/articles/synth/index.html| quote=Synth is new and provides for the description of the look and feel through an external XML file.| title=The Synth Look and Feel| publisher=javadesktop.org| author=Scott Violet| date=2004-03-26| accessdate=2013-03-09}}
2. ^{{cite web| url=http://www.ibm.com/developerworks/java/library/j-tiger10194/| quote=Synth is new and provides for the description of the look and feel through an external XML file.| title=Taming Tiger: Ocean and Synth meet Metal| publisher=IBM| date=2004-10-19| accessdate=2012-11-13}}
3. ^{{cite web| url=http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/nimbus.html| title=Nimbus Look and Feel (The Java Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)| publisher=Sun Microsystems| accessdate=2010-07-01}}
4. ^{{cite web| url=http://www.ibm.com/developerworks/java/library/j-synth/| quote=Synth lets developers rapidly create and deploy custom looks for an application by introducing the concept of a "skin" to Java UI programming| title=Advanced Synth| publisher=IBM| date=2005-02-01| accessdate=2012-11-13}}

External links

  • {{Javadoc:SE|name=Synth Look and Feel|javax/swing/plaf/synth}} API documentation
  • synth file format
  • synth tutorial
  • another synth tutorial
  • [https://archive.is/20110820062447/https://nimbus.dev.java.net/ nimbus home page]
{{DEFAULTSORT:Synth Look And Feel}}{{compu-library-stub}}

4 : Java (programming language)|Java (programming language) libraries|Java APIs|Widget toolkits

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/18 17:54:45