Last week i talked about using Substance decoration painters to visually offset Flamingo ribbon component. Jonathan Giles asked a question in the comment sections on how hard would it be to apply these improvements to an application running under other (core or third-party look-and-feels). I did not wish to rush into implementing it, and let it simmer for a while. A few possible solutions presented themselves, some involving colorization on the UI delegate level, and some involving off-screen images and overriding one of the paint methods in the main component.
As expected, the simplest solution is also the most powerful, since it can be applied to any Swing component / container, involves a few lines of code and doesn’t require any changes in the component library. It uses the JXLayer wrapper developed by Alexander Potochkin and one of the filters from JHLabs project.
The JXLayer is a very powerful component that deserves much more attention that it has been getting over the past couple of years. It allows intercepting events, masking out some parts of the UI area, providing validation feedback, adding custom painting and much more. In our case, all we need to do is:
- Wrap the ribbon in a JXLayer
- Add a painter to that layer
- Create an image effect and add a rescale operation on it that shifts the colors towards light blue
- Add the effect to the painter
At this point, all the visuals from the ribbon will be shifted towards light blue color:

All this amounts to extra 8 lines of code, as shown in the new sample application shipping with the latest 3.1dev drop of Flamingo. While this requires extra two jars in your classpath, the solution is not only elegant, but also applicable to any Swing component / container.
The release candidate for version 4.3 of Substance look-and-feel (code-named Nairobi) is available. The list of new features includes:
Target date for release is April 14. Only defects will be fixed until this date.
Here are some Swing links that you might have missed during this week:
- Is there new life for JDIC? It started with a big bang in 2004, pretty much died late 2006 when Mustang was released and now looks like it has received a renewed attention. The announcement on the forum introduces JDICplus project. At this stage it is a Win32-only wrapper around the Internet Explorer. The main page has four WebStartable applications that show IE, map explorer, flash viewer and HTML editor. The functionality looks very similar to the DJ Native Swing project, except the multi-platform support.
- Are you interested to know when Apple is going to release JDK 6.0? You can know the answer to this question, with one small caveat – you can’t tell anyone. Oh, and you have to pass the interviews and sign a few papers… If you are interested to work for Apple’s Java team on AWT, SWT, Swing and other areas, follow this link to read the job description and apply.
- Build 14 of 6u10 closes the bug on bringing SwingSet2 to be a better demo application for Swing. Looks like SwingSet2 will be no longer maintained, and instead will be replaced by two new java.net-hosted projects. The first is SwingSet3 that will show the core Swing features, and the second is Laffy that will act as look-and-feel test bed. Unfortunately, SwingSet3 is still a private project and can not be accessed (unless you have special privileges), and Laffy’s main page is still the template one.
- Robert O’Connor explores the different closures proposals and how they apply to primitive Swing applications. The first entry is on FCM, and the second entry is on BGGA. If you have a UI with one button and one-line action listener, you might even cut down the number of lines in your application :)
- Daniel Leuck proposes a format for packaging multi-resolution icons in Swing applications. This is one of the issues facing UI application running on high-resolution monitors. If you are interested in this subject, please consider coming to a birds-of-feather session that i will be presenting with Mike Swingler (of Apple’s Swing team) at this year’s JavaOne.
- Collin Fagan introduces a few JavaFX-inspired panels that aim to make it easier to work with core Swing layout managers. Why would anyone still want to use the GridBagLayout is a mystery to me.
- Thierry Lefort experiments with multiple popup toolbars that provide functionality similar to that of Office 2007 MiniBar (floatie). This topic has been mentioned in the session that Jensen Harris (lead designer of Office 2007) has presented at this year’s MIX conference (click here for the PowerPoint presentation or visit the site to view the video feed of the session). They eventually decided to have only one floating toolbar that fades out as you move the mouse away from it.
- Christophe Le Besnerais writes about a class that allows showing any Swing component in its own non-taskbar window. It doesn’t really go beyond providing a simple wrapper around the Popup and PopupFactory classes, and the translucency can be easily achieved by always using heavyweight popup windows, as explained in my entry on the translucent windows tricks.
Point of Sale (POS) systems are usually deployed at retail businesses such as restaurants or grocery stores. Most modern POS systems feature a touch-screen virtual computer that does not have keyboard or mouse. As such, it is operated by navigating through the available menus / features via on-screen selections. Due to the very nature of operating environment, these selections are done mostly manually (with fingers touching the screen). Here is how a sample POS system looks like:

And here is a sample screen of a POS system (click to see full size):

Since pressing your fingers on the screen is the only way to operate a POS system, all the controls need to be extra large.
I have already touched on subject of high-DPI support in Substance look-and-feel (part 1, part 2, part 3). Since the vast majority of Substance visuals are done with vector-based graphics, it should be able to scale to any font size. The real life, however, is not so simple and there are a lot of visual glitches that become apparent only at large scale values.
Here is a screenshot of an editable combobox using 72 pixel font under Substance 4.2. Note the clipped text, the gray margin around the text field editor and cap / join of the arrow icon:

And here is the same editable combobox under Substance 4.3:

Here is a screenshot of an icon button using 72 pixel font under Substance 4.2. Note the icon text gap, focus ring touching the text and the corners radius:

And here is the same button under Substance 4.3:

Here is a screenshot of a radio button using 72 pixel font under Substance 4.2. Note the checkmark text gap, focus ring weight, focus ring corner radius and the outer edge of the checkmark:

And here is the same radio button under Substance 4.3:

And finally, here is a screenshot of a checkbox using 72 pixel font under Substance 4.2. Note the checkmark text gap, focus ring weight and the focus ring corner radius:

And here is the same checkbox under Substance 4.3:

The latest development drop of Substance 4.3 has the first support for very large font sizes (which come with their own set of visual pitfalls, as illustrated above). It is in feature freeze state, with release candidate scheduled on March 31st, and the final release scheduled on April 14.
If you are interested in the topic of high-resolution monitors and the issues that they pose for UI applications in general, and for Swing in particular, please consider coming to a birds-of-feather session that i will be presenting with Mike Swingler (of Apple’s Swing team) at this year’s JavaOne. It is a little late (21:30 on Tuesday), but hopefully it will be worth it. Looking forward to seeing you.