Ayman Al-Sairafi has a very useful project called JSyntaxPane which provides syntax highlighting capabilities for the JEditorPane Swing component, supporting Java, XML, Groovy and JavaScript. I’ve already mentioned this project on the latest “Swing links of the week”, and this week i’ve integrated it into the Rainbow SVG file viewer.
Rainbow is a testbed for integrating various desktop projects and building an SVG browser for both local and remote (SVN) repositories. Instead of reinventing the wheel, it uses third-party libraries for the various UI building blocks. Here is the list of the libraries:
- Apache Batik for parsing and transcoding the SVG format.
- Flamingo for the breadcrumb bar, command button and command button panel components.
- Substance for the look-and-feel.
- JXLayer for the spotlight search functionality and applying effects before saving as image.
- JHLabs filters for applying effects before saving as image.
- SVNKit for working with SVN repositories.
- FormLayout for the layout of the top bar and status bar.
- JSyntaxPane for highlighting the XML and Java2D content.
When you click on any SVG icon, Rainbow shows three views of that icon. The first view shows the original SVG XML content, the second view shows the transcoded Java2D class, and the third view allows applying a number of filters and save the image. The JSyntaxPane comes in handy for the first two views – Rainbow now shows the XML and Java2D content with applied syntax highlighting.
Here is a screenshot of the XML content (click for the full view):

and here is a screenshot of the Java2D class (click for the full view):

The JSyntaxPane is available under Apache 2.0 license.
Over the course of the past few weeks the command button component in Flamingo component suite has been enhanced following the feedback from the project users. There is nothing better than getting the feedback from real-world use, and it is much appreciated on my side. Many thanks go to Kenneth Flynn and Christian Hebert for finding time to report these issues.
Supporting the disabled state
Calling setEnabled(false) on a command button will display the correct disabled state. As with the core AbstractButton, you can set a disabled icon with setDisabledIcon API. The helper org.jvnet.flamingo.common.icon.FilteredResizableIcon class can be used to wrap an existing resizable icon with a ColorConvertOp based on ColorSpace.CS_GRAY (core JDK functionality). Here is a screenshot of a few command buttons in enabled state:

And here are the same buttons in disabled state. Note how the visuals are changed to reflect the new state (including the foreground color of the main text and the extra text, as well as the popup arrow icon). The buttons in the first column specify a custom disabled icon (with the APIs mentioned above).

Supporting changing the text
Previously, once a command button has been created, it was not possible to change its display text with the setText(String) API. The new version supports this API, tracking the display text and recomputing the strings under the BIG and CUSTOM states as necessary. Here is a screenshot of a few command buttons with the default “Click!” text:

And here are the same buttons after they have been clicked a number of times. Each button has an action listener that counts the number of clicks and updates the button text accordingly. Note how the displayed text and the preferred size of the buttons are changed (automatically):

Supporting changing the font
Previously, the command button would ignore setting a custom font with setFont(Font) API. The new version supports this API. Here is a screenshot of a few command buttons using a custom italic font:

Support auto-repeat action mode
The auto-repeat action mode comes in handy when you want to have the action listeners invoked every N milliseconds as long as the button is pressed. This functionality is present, for example, on the arrow buttons in the core scroll bars. Once the scroll arrow button is pressed, it starts firing the scroll action events every 60 milliseconds after the initial delay of 300 milliseconds.
The JCommandButton component has two new APIs to support the auto-repeat action mode. Use the setAutoRepeatAction(true) to set the auto-repeat action mode on. The default initial delay is 500 milliseconds and the default subsequent delay is 100 milliseconds. To change the default values, call setAutoRepeatActionIntervals(int, int) API.
Support column-fill mode on command button panel
Previously, the command button panel component only supported row-fill mode. Under this mode, the buttons are placed in row-first fashion, wrapping the rows when the panel width is reached. Now, the component also supports the column-fill mode. Use the setLayoutKind(LayoutKind) API to specify the layout mode. Here is a screenshot of a command button panel with the default row-fill mode (note the vertical scroll bar):

and here is the same panel under the column-fill mode (notice the horizontal scroll bar):

This functionality is available in the latest 3.1dev drop of Flamingo.
The new Extras pack for Substance look-and-feel provides additional settings on top of the functionality available in the core library. The previous entry showed screenshots of color schemes, watermarks and skins from the Extras pack, and this entry will talk about button shapers, mixed color scheme and mixed gradient painters.
Additional button shapers can be found in the <font color="darkblue">org.jvnet.substance.shaperpack</font>
package. The screenshot below shows the available button shapers.

The <font color="darkblue">org.jvnet.substance.colorschemepack.MixColorScheme</font>
provides support for creating a color scheme based on more than one base color schemes. The <font color="darkblue">org.jvnet.substance.painterpack.gradient.MixDelegateGradientPainter</font>
allows wrapping an existing gradient painter to support mixed color schemes. The sample screenshot from the Mango skin (note the painting of scroll bar thumbs, checkmarks of radio buttons and checkboxes and the top part of the selected tab):

My “party of one” series of articles about one-man open source projects has been reprinted in an abridged form over at JavaWorld.com. Those of you who missed it the first time can either read the shorter version linked above or spend more time on the full series:
I’ve said it a number of times before, and i will repeat myself once again – interacting with your users and promptly addressing the bug reports is of paramount importance to the long-term success of your project. I’ve looked at the Issue tracker of Substance look-and-feel for some numbers on how do i live up to my own words, and here it is.
The numbers below are for 365 reported issues, 132 of which were determined to be valid bug reports.
- 121 (92%) addressed the same day or the next day.
- 130 (98%) addressed in three days or less.
- 95 (72%) fixed the same day or the next day.
- 104 (79%) fixed in three days or less.
Of course, i would like to see the last two numbers cross above 80%, or even into the 90%.