Substance look and feel - plugins

While the core library provides consistent visuals and animation effects for core Swing components, it also provides an extensible plugin architecture to extend the library functionality to third-party components - such as Flamingo and SwingX component suites.

Creating a plugin

Substance plugin is a jar file that contains at least the following two files:

The structure of META-INF/substance-plugin.xml descriptor is:

  <substance-plugin>
    <plugin-class>Class name</plugin-class>
  </substance-plugin>

The class name is a fully qualified name of a non-abstract class with a default zero-argument constructor that implements the org.pushingpixels.lafplugin.LafComponentPlugin interface.

The org.pushingpixels.lafplugin.LafComponentPlugin interface specifies the following methods which must be implemented by the plugin:

  /**
   * Initializes <code>this</code> plugin.
   */
  public void initialize();

  /**
   * Unitializes <code>this</code> plugin.
   */
  public void uninitialize();

  /**
   * Retrieves a collection of custom settings based on the specified theme.
   * The entries in the array should be pairwise, odd being symbolic name of a
   * setting, and even being the setting value.
   
   @param themeInfo
   *            Theme information object. Can be {@link MetalTheme}, for
   *            instance or any other LAF-specific object.
   @return Collection of custom settings based on the specified theme. The
   *         entries in the array should be pairwise, odd being symbolic name
   *         of a setting, and even being the setting value.
   */
  public Object[] getDefaults(Object themeInfo);

Reference plugins

There are two reference implementations of Substance plugins:

Using third-party plugins

In order to use a third-party plugin, just put it in the classpath (along with the substance.jar) and it will be picked up automatically.