Introducing Strider

September 16th, 2007

The previous teaser post showed a small video with “ripple” effects – an application showing a ripple overlay with waves originating on mouse click, bouncing off component borders and decaying over time, along with the superposition effects. It gives me a great pleasure to announce the first alpha drop of the Strider project (code-named Alento), that will provide these effects to Swing applications.

It provides a custom glass pane that can be installed and configured in the following way:

private RippleGlassPane rgp;

this.rgp = new RippleGlassPane(getRootPane());
this.rgp.ignoreClicksOn(JTextComponent.class, true);
this.rgp.markAsMedium(AbstractButton.class, true);
this.rgp.markAsWall(JTextComponent.class, true);
this.rgp.setOpaque(false);
this.setGlassPane(this.rgp);

The following RippleGlassPane methods can be used in the application code:

  • ignoreClicksOn – mouse clicks on the specified components will not result in a ripple wave.
  • markAsWall – bounds of the specified components will be marked as walls, resulting in ripple waves bouncing off.
  • markAsMedium – area of the specified components will be marked as medium, resulting in ripple waves propagating slower.

The current drop is in alpha stage, lacking a few features (proper support for resizing and granularity). It’s very small (about 28KB, and unlikely to gain much more as the development continues), and can be used in any Swing application. It should be noted that it’s quite CPU intensive, since the entire wave simulation is done in software.

Once again, thanks to Paul Falstad who donated the original code under the BSD license. Stay tuned for more.

Wolfgang is writing about a new component available in the latest release of Synthetica Addons called System Monitor:

If you’re interested about details on how to fetch the system information, look at this article i’ve written a few weeks ago for java.net. While some information is available in the System and Thread classes, you can access much more using JMX MBeans, including the information on threads and memory.

Note that with JMX, you can get the information not only on the current JVM, but on any running JVM that supports JMX. For now, it looks like the System Monitor component only allows tracing information on the current JVM (but i might be wrong).

New version of color wheel

September 12th, 2007

Luan O’Carroll of Xoetrope has been very active lately working on bug fixes and enhancements to the Xoetrope Color Wheel. It’s a Swing component that allows choosing colors in a very nice and visually appealing way, and it can be used in JColorChooser or as a part of larger UI (see video links below).

The latest additions available in the XUI itself as well as in the development version of Substance 4.1 add mouse-wheel support for the color wheel and the brightness / saturation sliders. This screencast shows the new features in action, and this screencast shows how the color wheel can be used in a larger UI.

In short, you can use the mouse wheel on the color wheel itself to play with the hue, and on the sliders to play with the brightness and saturation of the selected color. In addition, holding the Control key while wheeling over the sliders will apply the brightness / saturation on the color wheel itself. Here is how the color wheel looks like in default mode:

Color chooser Xoetrope color wheel - default

Here is how it looks like with decreased brightness:

Color chooser Xoetrope color wheel - decreased brightness

And here is how it looks like with decreased saturation:

Color chooser Xoetrope color wheel - decreased saturation

If you want to reuse this component in your code (like the Colorspace of Teppefall), make sure that you read and follow the terms of XUI license (identical to Mozilla Public License) in XUI.license of Substance distribution.

Supporting GroupLayout baseline

September 8th, 2007

GroupLayout was introduced in the middle of 2005 and later was added to JDK 6.0. It is the default layout manager used by NetBeans UI editor (code-named Matisse), and while the code using the GroupLayout tends to be very verbose and unreadable, the visual results are very pleasing as compared to other core Swing layout managers. For applications that require JDK 5.0, the swing-layout project provides JDK 5.0-compliant implementation.

This layout manager has introduced a concept of baseline that allows aligning components according to the perceived text baseline, instead of lining the components on the top border. This is especially relevant for form-based UIs that have grid-like arrangement of controls. In such UIs, you usually have labels in the first column followed by text fields, check boxes, combos and other controls in the subsequent columns. Here is an example:

As you can see, the alignment is far from perfect. The labels are incorrectly aligned with the text field, the combo and the password field. In addition, the labels are not spaced evenly. The implementation of GroupLayout includes hard-coded computation of baseline offsets for all core Swing components for the major core look-and-feels (Metal, Windows, Aqua and GTK). Here is how the same UI looks under Windows look-and-feel on Vista:

As you can see, the rows are aligned according to the text baseline, and the labels are equally spaced.

While this functionality is available out of the box for the core LAFs that were mentioned above and LAFs that extend those, there are three notable missing LAFs: Basic, Motif and Synth. Here is how the same UI looks under Motif:

What about the other two groups? There are a few third-party look-and-feels that extend either BasicLookAndFeel or SynthLookAndFeel. These include Alloy, Skin, Substance, Napkin, Liquid and Synthetica. Here are a few screenshots of these LAFs (Liquid, Napkin and Synthetica):

Following the request made by one of Substance users, the latest drop of Substance 4.1dev (code-named Lima) includes the new Substance Baselin plugin (that was refactored from the Substance NetBeans module). Once you add the substance-baseline.jar to your classpath, it will add the correct baseline alignment for applications that use GroupLayout from the swing-layout project under JDK 5.0.

Here are the before and after screenshots under Substance:

The license for this plugin is LGPL (the same as for the swing-layout.jar itself).

An astute reader would notice that the current implementation of JDK 5.0-compliant GroupLayout doesn’t provide builtin support for Synth-based LAFs. It would be interesting to see how Nimbus is going to address this issue, especially with the plans to backport it to JDK 5.0.