Synth Look and Feel

Last updated

synth is a skinnable Java look and feel, which is configured with an XML property file. [1]

Contents

According to Sun, goals for synth were:

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 Synth Look and Feel ). [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.

<synth><styleid="defaultStyle"><fontname="Verdana"size="16"/><state><colorvalue="WHITE"type="BACKGROUND"/><colorvalue="BLACK"type="FOREGROUND"/></state></style><bindstyle="defaultStyle"type="region"key=".*"/><styleid="textfield"><state><colorvalue="yellow"type="BACKGROUND"/></state><imagePaintermethod="textFieldBorder"path="textfieldborder.png"sourceInsets="5 6 6 7"paintCenter="false"/><insetstop="5"left="6"bottom="6"right="7"/></style><bindstyle="textfield"type="region"key="TextField"/></synth>

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 SynthLookAndFeel class):

SynthLookAndFeellaf=newSynthLookAndFeel();laf.load(newFile("synthExample.xml").toURI().toURL());UIManager.setLookAndFeel(laf);

See also

Related Research Articles

Java Platform, Standard Edition is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).

<span class="mw-page-title-main">Swing (Java)</span> Java-based GUI toolkit

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.

<span class="mw-page-title-main">Look and feel</span> Aspect of software design related to user interfaces

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, as well as the behavior of dynamic elements such as buttons, boxes, and menus. The term can also refer to aspects of a non-graphical user interface, as well as to aspects of an API – mostly to parts of an API that are not related to its functional properties. The term is used in reference to both software and websites.

<span class="mw-page-title-main">Standard Widget Toolkit</span> Graphical widget toolkit for use with the Java platform

The Standard Widget Toolkit (SWT) is a graphical widget toolkit for use with the Java platform. It was originally developed by Stephen Northover at IBM and is now maintained by the Eclipse Foundation in tandem with the Eclipse IDE. It is an alternative to the Abstract Window Toolkit (AWT) and Swing Java graphical user interface (GUI) toolkits provided by Sun Microsystems as part of the Java Platform, Standard Edition (J2SE).

<span class="mw-page-title-main">PyQt</span> Python GUI library

PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. PyQt is free software developed by the British firm Riverbank Computing. It is available under similar terms to Qt versions older than 4.5; this means a variety of licenses including GNU General Public License (GPL) and commercial license, but not the GNU Lesser General Public License (LGPL). PyQt supports Microsoft Windows as well as various kinds of UNIX, including Linux and MacOS.

The event dispatching thread (EDT) is a background thread used in Java to process events from the Abstract Window Toolkit (AWT) graphical user interface event queue. It is an example of the generic concept of event-driven programming, that is popular in many other contexts than Java, for example, web browsers, or web servers.

A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and extra scriptability.

<span class="mw-page-title-main">AveDesk</span> Widget engine for Windows XP

AveDesk is a freeware widget engine for Windows XP that runs small, self-contained widgets called "desklets", as well as ObjectDock "docklets", and is created by Andreas Verhoeven, a freelance software programmer.

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.

Layout managers are software components used in widget toolkits which have the ability to lay out graphical control elements by their relative positions without using distance units. It is often more natural to define component layouts in this manner than to define their position in pixels or common distance units, so a number of popular widget toolkits include this ability by default. Widget toolkits that provide this function can generally be classified into two groups:

<span class="mw-page-title-main">Workbench (AmigaOS)</span> Graphical user interface for the Amiga computer

Workbench is the desktop environment and graphical file manager of AmigaOS developed by Commodore International for their Amiga line of computers. Workbench provides the user with a graphical interface to work with file systems and launch applications. It uses a workbench metaphor for representing file system organisation.

<span class="mw-page-title-main">CEGUI</span>

Crazy Eddie's GUI (CEGUI) is a graphical user interface (GUI) library for the programming language C++. It was designed for the needs of video games, but is usable for non-game tasks, such as applications and tools. It is designed for user flexibility in look-and-feel, and to be adaptable to the user's choice in tools and operating systems.

swingLabs was a Sun open-source project proposing extensions to the Java Swing GUI toolkit. Available components included:

The Java Class Library (JCL) is a set of dynamically loadable libraries that Java Virtual Machine (JVM) languages can call at run time. Because the Java Platform is not dependent on a specific operating system, applications cannot rely on any of the platform-native libraries. Instead, the Java Platform provides a comprehensive set of standard class libraries, containing the functions common to modern operating systems.

<span class="mw-page-title-main">RichFaces</span>

RichFaces was an open source Ajax-enabled component library for JavaServer Faces, hosted by JBoss. It allows easy integration of Ajax capabilities into enterprise application development. It reached its end-of-life in June 2016.

ZK is an open-source Ajax Web application framework, written in Java, that enables creation of graphical user interfaces for Web applications with little required programming knowledge.

<span class="mw-page-title-main">Apache Pivot</span> Open-source platform for building applications in Java

Apache Pivot is an open-source platform for building rich web applications in Java or any JVM-compatible language. It is released under the Apache License version 2.0.

<span class="mw-page-title-main">Abstract Window Toolkit</span> Java-based GUI toolkit

The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. AWT is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support the Abstract Window Toolkit.

This article compares the application programming interfaces (APIs) and virtual machines (VMs) of the programming language Java and operating system Android.

References

  1. Scott Violet (2004-03-26). "The Synth Look and Feel". javadesktop.org. Retrieved 2013-03-09. Synth is new and provides for the description of the look and feel through an external XML file.
  2. "Taming Tiger: Ocean and Synth meet Metal". IBM. 2004-10-19. Retrieved 2012-11-13. Synth is new and provides for the description of the look and feel through an external XML file.
  3. "Nimbus Look and Feel (The Java Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)". Sun Microsystems. Retrieved 2010-07-01.
  4. "Advanced Synth". IBM. 2005-02-01. Retrieved 2012-11-13. Synth lets developers rapidly create and deploy custom looks for an application by introducing the concept of a "skin" to Java UI programming