While most applications do not benefit from changing the visual appearance (skins) at runtime, it is a valuable tool during the design phase of the project. There are two levels of visual changes for Swing applications – switching to a different look-and-feel by using the UIManager.setLookAndFeel call, or switching to a different skin in the skinnable look-and-feels.
Substance look-and-feel provides a few APIs that allow querying the available skins and changing the skins on the fly. Here is the list of steps that you need to do to add a combobox selector that shows all the available skins and changes the global Substance skin on selection change:
- Use the
getAllSkins() API to populate the combobox with the list of all available Substance skins.
- Use the
getCurrentSkin() API to select the combobox entry that matches the current Substance skin.
- Since the model entries behind the combobox are
<span style="color: darkblue;">SkinInfo</span> objects, extend the default Substance combobox cell renderer to use the display name of the skin.
- Finally, register an action listener on the combobox which gets triggerred on any selection change. The action listener uses the
setSkin(String className) API to set the selected skin as the new global Substance skin. Note that there is no need to explicitly invoke SwingUtilities.updateComponentTree on all your windows after calling this Substance API.
The complete code is available in the CVS repository. For more information on working with Substance skins, see the updated skin documentation.
The development of the next 5.2 version of Substance (code-named Quebec) is wrapping up. You’re more than welcome to take the latest 5.2dev binary drops for a spin. The release candidate is planned for May 11, with the final release scheduled for May 25.
A few hours ago an interesting changelist has made its way into the JDK 7 Swing branch. It definitely looks like the Nimbus designer will be available as part of JDK 7.
Unfortunately, it does look like this changelist does not contain all the files that are part of Nimbus designer (see below for the walkthrough), but hopefully this will be amended in the following days. In the meanwhile, here is what i’ve been able to do:
- Click on the zip link on the changelist page and extract the contents of the zip file. I’ve saved it in the C:\JTools\jdk7-src folder.
- Create a new Eclipse project. Point to C:\JTools\jdk7-src\jdk-c5cd40f1f596\make\tools\swing-nimbus\classes as source, and add all the jars in C:\JTools\jdk7-src\jdk-c5cd40f1f596\make\tools\swing-nimbus\libs as external jars.
As i said before, it looks like the changelist is not complete, and i haven’t been able to find the main class to run the designer itself. However, you can run the partial generation of Nimbus painters to get the feel of how that phase is working. Here are the steps:
Run the org.jibx.binding.Compile class passing the following two program arguments:
- C:\JTools\jdk7-src\jdk-c5cd40f1f596\make\tools\swing-nimbus\classes\org\jdesktop\swingx\designer\Designer.jibx.xml
- C:\JTools\jdk7-src\jdk-c5cd40f1f596\make\tools\swing-nimbus\classes\org\jdesktop\synthdesigner\synthmodel\SynthModel.jibx.xml
Copy the three .template files from C:\JTools\jdk7-src\jdk-c5cd40f1f596\src\share\classes\javax\swing\plaf\nimbus to C:\JTools\jdk7-src\jdk-c5cd40f1f596\make\tools\swing-nimbus\classes\org\jdesktop\synthdesigner\generator\resources
Run the org.jdesktop.synthdesigner.generator.Generator class passing the following arguments:
- -full false
- -skinFile C:\JTools\jdk7-src\jdk-c5cd40f1f596\src\share\classes\javax\swing\plaf\nimbus\skin.laf
- -srcDir c:\temp\nimbus
- -buildDir c:\temp\nimbus
- -packagePrefix org.nimbus
- -lafName Nimbus
At this point, the c:\temp\nimbus should have the generated painter classes. Note that if you pass the -full true, the generation will fail since some of the template files (such as LookAndFeel.template) are not part of this changelist.
Raven Graphite and Raven Graphite Glass skins were added to the Substance look-and-feel about two years ago, and they proved to be quite popular among the media-oriented applications powered by Substance. In the meanwhile, tools such as Microsoft Blend, Apple iPhoto and the TweetDeck client have continued refining and polishing the visuals or their own graphite-themed interfaces, and time has come for a facelift of Substance skins as well.
Here is a screenshot of a sample application under the Raven Graphite skin in the latest stable 5.1 release:

and here is the same application under Raven Graphite in the latest 5.2dev drop:

Here is another screenshot of the same application under the old Raven Graphite visuals:

and the new visuals under the latest 5.2dev drop:

There are three major changes in these screenshots:
- Light highlight color schemes for lists, tables, trees and menus
- Lighter and partially translucent inner border painting on the buttons, tabs, checkmarks and more
- Removing the inner border painting from scroll bars
The same changes have been applied to the Raven Graphite Glass skin. Here is the screenshot before:

and after:

And one more screenshot before:

and after:

If you want to take the new visuals for a spin, click on the WebStart button below and change the skin to Raven Graphite and Raven Graphite Glass from the “Skins” menu:

You’re more than welcome to take the latest 5.2dev drop for a spin and leave your comments.
Substance 5.2 (code-named Quebec) is going to have a few new skins. About a week ago i wrote about the new Dust skin, and today it is joined by the new Dust Coffee skin. If you want to take it for a spin, click on the WebStart button below and change the skin to Dust Coffee from the “Skins” menu:

To use it in your application, you have the following three options:
-Dswing.defaultlaf=org.jvnet.substance.skin.SubstanceDustCoffeeLookAndFeel
UIManager.setLookAndFeel(new SubstanceDustCoffeeLookAndFeel())
UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceDustCoffeeLookAndFeel");
While it takes most of the visuals from Dust, it changes the colors of the default decoration area to a light yellowish brown, and uses the active color scheme of the Creme Coffee. In addition, the latest 5.2dev drop brings a few contrast improvements to both Dust and Dust Coffee that address some of the problematic visuals pointed out by Andrey Eremchenko. As before, this is an ongoing process and all core Substance skins continue to be polished throughout the release cycles.
Here are a few screenshots that show the new Dust Coffee skin. A small frame with a tabbed pane and a few different controls:

A frame with menu bar, tool bar and status bar from SwingX project:

A thumbnail of the main Substance test application (click for full-size view):

As with all Substance core skins, this is work in progress and will be polished over time. In the meantime, you’re more than welcome to take the latest 5.2dev drop for a spin and leave your comments. Note that both Dust and Dust Coffee do not play well with the Flamingo ribbon component. This will be addressed in the next major Substance release tentatively planned for autumn ’09.