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

  • Jacek Furmankiewicz posted a series of three entries on builders for Swing layout managers. The first entry shows two prototypes for wrapping Mig layout manager in a Java builder, the second entry explores a more WYSIWYG approach (which looks like a simplified version of ZoneLayout, since the example itself is also very simple), and the last entry tackles a more complicated example of ZoneLayout. Personally, the use of white space to drive the layout does not sound like the best idea. It’s hard to debug (make, anyone?), it’s prone to whitespace / tab conversion problems, and it poses significant challenges to refactoring control names.
  • Anthony Goubard posts a few screenshots of new demo applications created for 6u10 version of JDK. As mentioned last week, these are SwingSet3 and Laffy. The bundled demo folder has a simple HTML page for each one of the projects that point to the actual java.net content. SwingSet3 is now publicly available, and you can run the WebStart version here. Hopefully Laffy‘s homepage will be updated soon.
  • Geertjan Wielenga has a short tutorial on using Spring framework for building Swing applications. The usual pains of Spring approach apply, and that would include compile-time errors moved to runtime, tons of XML wiring for anything but sample applications (which also needs to be edited manually in most IDEs and is hard to refactor) and a few dependency jar.
  • Robert O’Connor rounds up the comparison of the three Java closures proposals with an example of applying CICE to a sample Swing application. I don’t really agree with Robert’s point that the main problem with Java is its verbosity. I think that the biggest pain point of Swing (at least for beginners) is the over-flexibility of Swing API and lack of “the true way” to achieve a specific functionality. And the second one is lack of video capabilities, which would hopefully be addressed at this year’s JavaOne (see below).
  • Nazmul Idris is back with the first part of tutorial on his new Task API for Swing applications.
  • The OpenJDK Innovators’ Challenge has announced the finalists, and both UI-related proposals are in. Congratulations to Clemens Eisserer, Roman Kennke and Mario Torre.

The session catalog for JavaOne 2008 has been published, and it has quite a few desktop-related technical and bird-of-feather sessions. Out of the entire Desktop track and Rich Media track, here are a few interesting sessions:

  • TS-6649 / Desktop Track Overview & New Features in the upcoming Java 6u10 Platform by Hans Muller and Ethan Nicholas. This might hold some interesting news for the Java desktop developers, especially in light of BOS-6511 and TS-6509.
  • TS-6611 / Filthy-Rich Clients: Filthier, Richer, Clientier by Romain Guy and Chet Haase.
  • BOF-6511 / The Java Media Components API BOF.
  • BOF-5037 / High-Resolution Monitors: Make Your User Interfaces Scale with the Future by Mike Swingler and I.
  • TS-6609 / Using JavaFX Script To Build Swing Applications by Amy Fowler and Hans Muller.
  • TS-6929 / Creating a Compelling User Experience by Ben Galbraith.
  • BOF-6101 / Nimbus: Beyond the Basics by Richard Bair and Jasper Potts.
  • TS-6096 / Nimbus: The New Face of Swing by Richard Bair and Jasper Potts.
  • TS-6656 / Extreme GUI Makeover: Swing Meets FX by Christophe Campbell and Shannon Hickey.
  • TS-5500 / The Desktop Java Lovers Survival Guide by Joe Winchester.
  • TS-6509 / Incorporating Media into JavaFX™ and Java™ Technology-Based Applications by Marc Owerfeldt and Tony Wyant.

Please browse through the entire session catalog for more desktop-related presentations by my friends Alexander, David, Richard, Andres, Mikael and more.

The announcement of JDICPlus project that was made last week was a little unexpected. This was mentioned in the latest installment of Swing links of the week, and subsequently picked by DZone and java.net editors. The comments on both the original announcement and on the DZone thread are mixed, and most commentors point out that JDIC and JDICPlus could provide a little bit more information on their status and roadmaps.

Alexey Utkin is the man behind the JDICPlus project, and he graciously agreed to answer a few questions that i had in mind.

Tell us a little about yourself.

Alexey Utkin avatarI was born in 1971 in Saint-Petersburg, Russia and still living here. I started writing programs at school and never stopped doing it. I got my PhD diploma in physics and mathematics in St.-Petersburg State University where I am lecturing now at Calculating Physics Department. The longest period of my developer’s life was spent working in Novavox company. For a year before joining Sun Microsystems, I worked for Borland till closing of the local office. Since 2006 I work as a developer in AWT group. I like fine solutions of complicated problems, read with interest avva’s live journal and Facebook puzzles.

Can you overview the history of JDIC project?

Really I can not. The only history that is accessible for me is the diffs in CVS. Some ideas were brilliant, and others were not. My last 15 years were spent for DOS/MS Windows development in C++. In Windows OS family the browser embedding was never a problem, so I did not need JDIC before.

The JDIC project has not seen any substantial activity after a lot of its functionality was incorporated into Java SE 6. Do you know the reasons?

The answer is in your question. Most of the JDIC functionality was transferred to Java SE 6. The browser part was not. An approach with inter process communication over a socket connection is not suitable for real life. But any released solution in Java becomes a standard, especially in case of browser component. My opinion is that JDIC browser
reached the top of functionality in the confines of the chosen architecture, but it was not enough for main stream release.

What is JDICPlus? Is it your personal hobby, simple exploration of new ideas or the renewed investment from Sun in JDIC for Java SE 7?

It’s clear that Java needs standard embedded browser. We are working on it. Of course, JDICPlus is not a candidate for Java SE 7. JDICPlus is a part of my research work about an ability to use native browser as some kind of an external AWT/Swing component. Currently it is a personal hobby. I tried to create primitive communication with browser and take mostly the native renderer. DOM and events treatment subsystems are already inside and it works perfect with Javascript. If you get the connection point from Java level to Javascript with callback ability – you have everything that you can for free.

Is there a roadmap for JDICPlus? What are the projected areas that it is going to concentrate on, and what are the target platforms?

At present the JDICPlus project doesn’t have an “official” status. It is an incubator in the full meaning of the word. Currently there is no roadmap for JDICPlus at all. I will spend the time implementing the most essential OS functionality that is not accessible from Java. JDICPlus CAB format coder/encoder with ZipInputStream/ZipOutputStream interface is such an example. For browser it is possible to capture new window creation event – that is done in TabbedBrowser (WebStart link). There are the problems with child windows rendering and common stability. I hope to solve it soon.

Are there any plans to port the support for translucent and shaped windows to JDIC or JDICPlus, so these can be used on JDK 5.0?

JDICPlus supports very strict approach to shaping and translucency that makes IE browser similar to real lightweight component. Potentially it could be propagated to JDK 5.0, but all project orients to JDK 6.0. The problem is complicated, especially taking the cross-platform aspect into account. Please wait for the main stream release solution.

Are there any plans to investigate support for cross-platform browser toolkits, such as Webkit or Gecko?

Gecko is progressing too fast. Attempting to embed Gecko is a constant challenge. The key part of API is incompatible with older versions, and you can not distribute Gecko together with your product. That is a dead circle and JDIC is a good example. May be something will change in future. Webkit is impressive, but young. Let’s wait and see.

Are there any plans to handle the issues reported on JDIC over the past eighteen months?

The most critical bugs reported on main stream release (based on 0.9.2) will be fixed. But the main project is frozen for new features.

What are your thoughts on pure-Java solutions as opposed to embedding native components / toolkits?

Let’s try to be realistic. I don’t think that Sun has any reason to join the browser war. The existing pure-Java solution in Swing is acceptable for rendering simple HTML snippets. But now nobody is interested in a partial solution. The compromise is available and more or less predictable. Wait…

What would be your top three wishes for Java desktop?

  1. Standard cross-platform solution for embed browser (surprise?! )
  2. Shaping and translucency (smile)
  3. Perfect MS COM/DCOM interconnection with Java classes. It can really make Java the number one development environment under the MS Windows.

With this, i hope that at least some of your questions have been answered. I’d like to thank Alexey for agreeing to answer my questions.

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.