Support for SwingX components – part VII
June 24th, 2007 | 4 Comments »This is the seventh part in the ongoing series of providing support for SwingX components in Substance look and feel.
- The first part showed the support for JXTaskPaneContainer and JXTaskPane.
- The second part showed the support for JXStatusBar.
- The third part showed the support for JXTitledPanel.
- The fourth part showed the support for JXTipOfTheDay.
- The fifth part showed the support for JXLoginPanel.
- The sixth part showed the support for JXMonthView.
This part will show the support for JXHeader. As with other components, the UI delegate for JXHeader respects the header painter of the current skin, which results in a consistent and unique appearance for the “decoration” areas of the UI. Here is a screenshot of a JXHeader under Business skin:

The same frame under Business Black Steel skin:

The same frame under Mist Silver skin:

The same frame under Nebula Brick Wall skin:

The same frame under Office Blue 2007 skin:

The same frame under dark Magma skin:

Note that the icon in the screenshots above is application-specific (not set by the UI delegate). The test application uses the same icon and colorizes it using the theme colors of the current skin.
Related posts:
- Support for SwingX components – part II This is the second part in the ongoing series of providing support for SwingX components...
- Support for SwingX components – part V This is the fourth part in the ongoing series of providing support for SwingX components...
- Support for SwingX components – part III This is the third part in the ongoing series of providing support for SwingX components...
- Support for SwingX components – part IV This is the fourth part in the ongoing series of providing support for SwingX components...
The window title is a little bit confusing…
Thanks, Wolfgang. This has been fixed.
Would you mind explaining how the icon is colorized using the theme colors and is it possible to generalize this, e.g., let toolbar icon colors follow the current theme colors?
Carsten,
There are two methods in the internal SubstanceImageCreator class that are used for this purpose in Substance code. They are getThemeImage(BufferedImage, SubstanceTheme, boolean) and getThemeImage(Icon, SubstanceTheme, boolean). Note that this is not a supported API and is subject to change / move to another class at any time.
The implementation is fairly straightforward (but not very optimized) – i compute the luminance for each pixel (30% red, 59% green and 11% blue), and then use this value to map to the color range of the specified theme (and preserve the alpha channel of the original pixel). Most probably this can be done more efficiently with some BufferedImageOp, but i haven’t found the need to do so, since i use these methods statically (not at every repaint).
Thanks
Kirill