It has been added last October, but only now i feel that it has been polished enough to have it officially supported and released. The latest 4.0dev drop of Substance provides full support for a new toned-down skin named Autumn. It is similar to the Creme skin, but even less intrusive. It is one of the two new skins that use the same theme for default and disabled controls. In order to differentiate these two states, a skin defines a custom alpha value (translucency) for the disabled state. The end result (see screenshots below) is that the disabled controls appear less “visible” as the default controls. This also means that if you set a non-null watermark, it will “shine through” the disabled controls.

Here are a few screenshots of different controls under the new Autumn skin. Buttons, toggle buttons, checkboxes and radio buttons in different states (default, selected, disabled and disabled selected):

Comboboxes in different states (default, active, disabled, with custom background):

An internal frame with a few controls:

Horizontal and vertical sliders in different states (enabled, disabled, ticks, labels, RTL). Note the translucent layers on the disabled sliders:

Progress bars (horizontal, vertical, determinate, indeterminate, with caption):

Tree with a selected and rollover path:

A control panel with different controls embedded in a SwingX task pane:

SwingX error pane:

SwingX month view:

A frame with menubar, toolbar and status bar from SwingX:

You’re welcome to try this skin and report any issues / RFEs that you find.

I’ve started playing with custom alpha channel settings for certain component states. Look at the following screenshot:

Text rendering bug on JDK 6.0 2

The checkbox and the radio button on the second line are disabled. The checkbox and the radio button on the last line are selected and disabled. As you can see, in general, you would use three color schemes for three major component states: active (selected, rolled over, pressed), default and disabled. In most cases, the disabled color scheme uses the same color values as the default color schemes, but the overall colors are a little brighter. So, i was toying with the idea of using the same color scheme for both default and disabled states, but set arbitrary alpha for the disabled state.

The implementation is a little complicated (especially since there are so many core components), and this is what has been taking my time lately (with no posts on Substance in the past few days). And just when i thought it was progressing smoothly, i hit this:

Text rendering bug on JDK 6.0

It took almost two hours to isolate this problem to a small and complete test application which i posted at the Java2D forum over at java.net. So, don’t be surprised to see a few garbled strings if you’re running under the latest 4.0dev drops of Substance and using the experimental Autumn and Magma skins. I think that i’ll be able to find a workaround for this bug(?), but i’ll wait to see the replies on the forum linked above.

Update: Phil Race from Sun’s Java2D team has confirmed this bug and provided a workaround. See the thread at Java2D forum for the suggested workaround (confirmed to work on Vista). Thanks, Phil.

 

Swing WTFs

June 30th, 2007

Over the past two+ years that i’m developing Substance, i’ve seen my share of the lengths the programmers go to bend Swing APIs to their will. The very nature of a look and feel library in most cases prevents me from asking my users to fix their code, since such a library is supposed to be a simple drop-in. So, this is just a small sample of the application quirks that found their way into Substance codebase:

  • A visible progress bar with zero bounds
  • A combobox that switched “editable” mode depending on the selected index
  • A toolbar embedded in a panel embedded in another toolbar
  • A custom table renderer providing custom painting and ignoring the opacity setting
  • A null tab in a tabbed pane to be filled only when it’s selected
  • An application running with a boot classpath loader
  • An OS-specific defect (WORA anyone?) Especially irritating if you don’t have access to such OS.

By the way, the next time you consider writing a look and feel, you’re welcome to start here.

I’m always excited to see an announcement of a new look and feel (or even a new skin in an existing look and feel). Writing such a library is quite a complicated task that requires a lot of resources and perseverance. And so, it is my great pleasure to see two new third-party look and feels announced in the last couple of days.

The first is A03 and comes from Davide Raccagni. Very nice and polished visuals, a lot of smooth animations and transitions, and even the initial theming support. It has a few interesting ideas that i would like to incorporate into future versions of Substance, such as “flowing” menus and extended file chooser. The license is very permissive (BSD), and the only thing that might hinder its acceptance is the minimum JDK requirement – JDK 6.0.

Screenshot of A03

The second is Titanium and comes from Teppefall Labs. It extends one of the dark skins from Substance and provides a modern-looking, clean and consistent skin for desktop applications. My original intent was to make Substance as extensible as possible, and this is the first time i am aware of a third-party look and feel that extends it. Hopefully, most of the extension hooks are already in place, and if not, they will be.

Screenshot of Titanium