Here are some Swing links that you might have missed during the last three weeks:

  • Gregg Bolinger extends the application-wide hotkeys with a lookup dialog, complete with wiring the events for navigating and canceling.
  • Roman Kennke summarizes the Caciocavallo project that aimed to create portable GUI backends for OpenJDK graphics stack.
  • Santhosh Kumar has an interesting solution for cross-LAF combobox with group separators. The solution involves putting the grouping logic inside the renderer, and one of the commenters wonders whether this logic should be part of the model or of the specific view.
  • Piet Blok writes about the JXLayer project and his experiments with multiple layers and sharing UI instances.
  • Alexander Potochkin has assumed the role of specification lead for reference implementation of JSR 295 (Swing Application Framework). He shares his thoughts, outlining the proposed changes and soliciting feedback on his blog, and has already submitted a few changes to the project source repository.
  • Native font rasterization is one of the major features added to JDK 6u10 on Windows platforms, and has impressed Naiden Gochev that has screenshots of old rasterizer, SWT (native) rasterizer and NetBeans running under the new rasterizer. Too bad that the Windows look-and-feel only uses Segoe UI on the menus…
  • Jasper Potts sums up the work he and Richard Bair have been doing on Nimbus look-and-feel. Perhaps the more disappointing part is that the highly-anticipated designer tool announced last September still can’t be made available to the public. The followup post has an example of skinning a slider under Nimbus. If you plan on customizing Nimbus with painters, note that the com.sun.java.swing.Painter interface is only available in JDK 6u10, so you might as well instantiate Nimbus with the fully qualified class name instead of iterating over available LAFs and querying their names.
  • On the Synth-related note, Xavier Young has started a series of tutorials on configuring the EaSynth look-and-feel. The first part is on general button customization, and the second part is on arrow buttons, check boxes, radio buttons and toggle buttons.
  • Yves Zoundi has announced release 0.0.3 of VFSJFileChooser component that extends the JFileChooser to browse remote file repositories such as FTP, SFTP, WEBDAV and more.
  • Andres Almiray writes about Groovy new binding features, their applicability to SwingBuilder and the comparison with JavaFX binding.
  • Christophe Le Besnerais continues his explorations on modern interfaces, aiming to recreate the look similar to that of OnWired web site in Swing.
  • Michael Bar-Sinai proposes solutions for complex table cell rendering logic in his java.net article. In particular, he has a class-based and rule-based approaches for separating same-column rendering logic into more manageable code.
  • Finally, Maxim Zakharenkov has released version 1.3 of SwingExplorer project. New in this release – NetBeans plugin and tracing component addition.

The goal of Flamingo project is to provide a small and cohesive set of powerful UI components with functionality similar to or superseding that of Vista Explorer and Office 2007. Command bar is one of the more complicated UI components in the Office 2007, and Flamingo’s JRibbon is the all-Java implementation of this component. It is already being used by a number of projects which provide valuable feedback on the missing parts and help in prioritizing their development. Recently, i have added two user-requested features to the JRibbon – modifying the contents of in-ribbon galleries and support for contextual tabs.

The documentation of JRibbon has been updated to bring it in-sync with the latest 3.1dev branch. If you’re new to this component, start with the overview and then delve into the specifics of each one of the ribbon’s building blocks.

To read more on modifying the contents of in-ribbon galleries scroll down to the “Dynamically changing gallery content” section in the ribbon bands page. To read about contextual task group, first read the page on creating a task group and then read the “Working with contextual task groups” section of the ribbon creation page.

Here is a screenshot of a ribbon with selected contextual tab. Note the vertical lines that separate the tasks in the two contextual groups. Also note the different background colorization of the task toggle tab and the top portion of the ribbon – this is done to provide visual indication that the currently selected task is a contextual one.

This marks the last new features for the version 3.1 of Flamingo. You’re more than welcome to download the latest 3.1dev drop and try it in your applications. The release candidate for Flamingo 3.1 is scheduled on September 1 with the final release scheduled on September 15. Click on the button below to launch a demo of JRibbon component in action (requires Java 6).

Here are some Swing links that you might have missed during this week:

  • Jon Lipsky is back from a two-year long blogging hiatus and he writes about extending the RelativeLayout from James Elliott’s 2002 article.
  • Santhosh Kumar is back as well (he’s not been blogging about Swing since last August), and this time he brings the auto-snap split pane divider. The solution is very simple, but i’m not sure of the usability of this particular feature. In the past, i always found the different auto-snap behaviors (such as windows in desktop managers or connectors in Visio) to stand in my way most of the time, leading me to fight with the UI. On the other hand, auto-snap in sliders is quite a useful features to restrict the input domain to a small discrete subset.
  • JavaSwing.net continues its series of tutorials on Swing text components, and this time they write an introduction to working with JFormattedTextField component.
  • Gregg Bolinger has an implementation of application wide hotkeys. It uses a custom EventQueue that inspects all KeyEvents and consumes those keystrokes that it sees as the custom hotkey launchers. If you decide to follow this route, be sure to read Hans Muller‘s post on the mailing list of AppFramework project from last October:

The downside is that I’ve spoken with the AWT technical lead and he’s suggested that using EventQueue.push() is deadlock-prone. That is, the area of code that deals with EventQueues is quite complex and there may be unknown bugs that could cause deadlocks.

  • And finally, Ken Orr tracks an interesting problem of providing different visuals for controls in active and inactive windows. His solutions include checking Window.isFocused in various painting methods (such as JPanel.getBorder and JLabel.getForeground) and tracking the changes to “Frame.active” client property.

My number one wish for Java desktop for this year was cross-platform support for H.264 and FLV formats. Today has marked a first (and hopefully not last) step towards playing video content in Swing application – Java Media Components which is a part of JavaFX preview SDK.

Here is what you need to do to use JMC in your Swing application:

  1. Download and install the JavaFX preview SDK. The rest of the steps assumes that the SDK has been installed in the C:|Program Files/JavaFX/javafx-sdk1.0pre1 folder.
  2. Add the lib/jmc.jar to the classpath of your project.
  3. Use one of the examples from the JavaOne presentation on JMC (see full code below).
  4. Run the application with the following VM flag: -Djava.library.path=”C:/Program Files/JavaFX/javafx-sdk1.0pre1/lib”

I have tested the current JMC drop on the following formats:

  • Flash content – FLV and SWF files. While the regular content plays correctly, i have not been able to interact with the content of an interactive SWF file.
  • Container formats – AVI, MPG, MKV.

I have not been able to play the MOV files (H.264). Hopefully this will be addressed in the future releases of JMC, even before providing a cross-platform codec from On2.

Here is a sample screenshot of JMC playing an MKV file on a frame with translucent reflection (click to see the full size version):

JMC playing an MKV file in a frame with translucent reflection
JMC playing an MKV file in a frame with translucent reflection

MKV is a popular container format for video / audio content, and it is used by Azureus Vuze application. The screenshot above shows the trailer of “Watchmen” movie, and while Azureus uses the native executable for MPlayer to play these files, JMC goes a step further and exposes a Java API layer to Swing applications. You can find the full source code behind the screenshot at this location.