

Multiplexing- a way to have the UI methods delegate to a number of different look and feel implementations at the same time.įor Linux and Solaris, the System L&Fs are "GTK+" if GTK+ 2.2 or later is installed, "Motif" otherwise.

Synth-the basis for creating your own look and feel with an XML file. The System L&F is determined at runtime, where the application asks the system to return the name of the appropriate L&F. SystemLookAndFeel-here, the application uses the L&F that is native to the system it is running on. It is part of the Java API ( ) and is the default that will be used if you do nothing in your code to set a different L&F.


For example, the Java Look and Feel creates an instance of MetalTabbedPaneUI to provide the L&F for JTabbedPane. It is the responsibility of each L&F to provide a concrete implementation for each of the ComponentUI subclasses defined by Swing. By delegating painting, the 'look' can vary depending upon the L&F. For example, all painting in JComponent subclasses is delegated to the UI delegate. For the most part, the UI delegate is used internally by the JComponent subclass for crucial functionality, with cover methods provided by the JComponent subclass for all access to the UI delegate. Most developers never need to interact with the UI delegate directly. The ComponentUI subclass is referred to by various names in Swing's documentation-"the UI," "component UI," "UI delegate," and "look and feel delegate" are all used to identify the ComponentUI subclass. For example, every JList instance has a concrete implementation of ListUI ( ListUI extends ComponentUI). Swing's architecture enables multiple L&Fs by separating every component into two distinct classes: a JComponent subclass and a corresponding ComponentUI subclass. "Look" refers to the appearance of GUI widgets (more formally, JComponents) and "feel" refers to the way the widgets behave. The architecture of Swing is designed so that you may change the "look and feel" (L&F) of your application's GUI (seeĪ Swing Architecture Overview).
