If you are new to Swing, start with the general Swing tutorial. If you are new to look-and-feels, read the getting started first.
To use Substance in your applications, choose one of the following options:
- Use one of the skin-based look-and-feel classes (light or dark).
- Extend the
SubstanceLookAndFeel
class and pass aSubstanceSkin
instance to the super constructor. - Use the static
setSkin(SubstanceSkin)
orsetSkin(String)
APIs to set the specific skin.
In any case, add the latest substance.jar
to your classpath.
If you wish to build Substance from the sources, you will need to also get laf-plugin and laf-widget (binaries or sources). The best way is to sync to the latest and use the build.xml
script. The main test application uses the FormLayout and components from SwingLabs.
Have a question? See the FAQ and the list of known issues, and if you don't see an answer there, file a bug or get in touch.
If you've skipped getting started page, to add Substance to your app follow these steps:
- Go to the main project page.
- Navigate to the drop folder. This should take you to the sub-folder that contains the downloads for the latest stable release.
- Click on the specific X.Y.ZZ row. It's highly recommended to always use the latest stable release.
- Download substance-X.Y.ZZ.jar file from there.
- Also download trident-L.M.NN.jar file from there - this is the Trident animation library that is a required runtime dependency.
You can use Substance-specific settings and APIs to add custom functionality to your components. See the list of API calls, client properties and VM flags for more information. To configure the animations, consult the animation overview.
Substance can be customized to fit your visual needs. The overall visuals are controlled by skins, with each skin defined by color scheme bundles and painters. The skinning primer has a few tips on how to use the different Substance painters in applications that wish to paint custom components in a way that is consistent with other Substance visuals. The Substance samples project provides a detailed walktrough that analyzes a complex UI mockup and uses different Substance APIs to implement it.
While the core Swing components cover the basic UI functionality found in most applications, modern UIs need modern UI components. To address this need, Substance comes with a built-in support to allow defining and seamlessly loading plugins that provide consistent appearance and interaction for third-party components.
During the initialization, Substance looks in the classpath for the META-INF/substance-plugin.xml
descriptor files. The <component-plugin-class>
element should contain the fully qualified name of a class that implements the LafComponentPlugin
interface. This interface defines the lifecycle of a Substance plugin, with the main extension point that allows setting custom entries in the UIManager
tables.
Substance plugin for Flamingo components is the only actively developed and fully supported plugin.
Substance plugin for SwingX components has been aligned with the latest Substance sources. However, since the core SwingX project is effectively dead (last official 1.6.4 release is from July 2013), there is no more active development in that plugin.
Substance Extras pack provides additional watermarks, color schemes and skins and is another example of a Substance plugin.