Here are some Swing links that you might have missed during this week:
- Clemens Eisserer continues working on the XRender pipeline for Java2D, and has a few screenshots showing the progress of this project. Part 1, part 2 and part 3 show different test applications under this pipeline.
- A message from Richard Bair on the mailing list of AppFramework (reference implementation of JSR 296) announces that Alex Potochkin has taken over the ownership of this project. The time indeed has arrived – the last source commit was in October 2007, and while Alex hasn’t posted any message on the mailing list / his blog, i would assume that he is taking his time making himself familiar with the project itself and the JCP / JSR process in general.
- Alex himself continues writing about the JXLayer project and talks about the internal painting implementation in his latest entry. Jing Ge has a follow up entry in which he builds a complete validation module using BeansBinding, JXLayer and Hibernate Validator.
- Xavier Young has a short introduction for using the EaSynth look-and-feel.
- Ethan Nicholas introduces the JavaCSS project that aims to provide CSS support for styling Swing and JavaFX components. While the amount of comments on this entry indicates a significant level of interest in this project, it would be interesting to see how well will it be able to cope with the expectations implied by using the “CSS” in its name. As mentioned by Ben Galbraith in his JavaOne 2006 session, Swing and HTML are sufficiently different in that you can not take the existing “pure” CSS directives and apply them on Swing components. In addition, implementing the layout constructs of CSS may require changing the existing application layout managers. Throw the look-and-feel layer into the mix (don’t forget that the look-and-feel is responsible for computing the inner metrics of Swing components, such as margings, padding, gaps, etc), and you get quite an interesting challenge.
- Ken Orr writes about unified toolbar buttons in his quest to emulate the appearance of native Mac applications. Surprisingly, this entry features a rather questionable advice on using the SwingUtilities2 class. Not sure about the Apple VM, but this is a strict no-no for even Sun VMs. Not only this class is in an internal sun package, it has also changed location between JDK 5.0 and JDK 6.0. What’s the alternative for SwingUtilities2.drawStringUnderlineCharAt? Call BasicGraphicsUtils.drawStringUnderlineCharAt and install the desktop rendering hints before that.
- This is most probably will be a part of the next weekly JDK 7 build. Bug 6725214 on forward-porting the new D3D rendering pipeline from 6u10 has been marked as Fix delivered. For the brave souls wishing to venture into the implementation details, follow this Mercurial changeset. No word yet on porting the support for shaped and translucent windows and which package that might end up in.
- Jacek Furmankiewicz continues working on the Java SwingBuilder project, and this time he writes about adding an SWT-style API for creating menus.
- And finally, Richard Kennard adds component wiring based on Commons JEXL to his MetaWidget project, aiming at those environments that don’t have expression languages built into the language (such as Swing).
Here are some Swing links that you might have missed during this week:
- James Williams has a tongue-in-cheek list of five tips to tame Matisse layouts. This resonates with my earlier post on JBuilder and getting locked to an IDE that enforces any non-standard logic on the UI code that it creates.
- Luan O’Carroll writes about distributing a WebStart application via CD-ROM, expanding on such subjects as WebStart cache, not relying on existing JRE installations, working with no Internet connection and others.
- Build 27 of 6u10 is out and it addresses the issue that prevented applications from using the Synthetica look-and-feel. It also features performance improvements for Nimbus (about 8% as measured in the dynamic performance suite from the LightBeam project). Although not official, we can expect the release candidate of 6u10 this week.
- Ken Orr writes about a custom implementation of placard button commonly found in Mac applications.
- Alexander Potochkin introduces yet another useful feature of his JXLayer project – ability to lock (disable) the entire Swing container, including blocking any user interaction with its children.
- The “Ask the Experts” session on 6u10 is over, and (much like two years ago), i had a question that was not addressed. I will be polite and blame the intratubes, but the topic at hand will be a subject of a forthcoming entry.
Every once in a while i get questions on using the Mac OS X menu bar for Swing applications running under Substance look-and-feel. This refers to the apple.laf.useScreenMenuBar VM flag that is respected by the native Aqua look-and-feel (and its third-party Quaqua extension). Up until this week the only advice that i could give was to use AWT menus (thanks to Quaqua’s author Werner Randelshofer for this). However, it is not the optimal solution for cross-platform Swing applications that wish to use Swing menus on non-Mac platform.
As i was thinking about this problem after being recently contacted by Sergiy Michka, i thought about an alternative solution which was later reviewed by Swing lead for Apple VM Mike Swingler. The solution is not specific to Substance and should work under other core and third-party look-and-feels that allow mixing menu UI delegates from other look-and-feels. Here is what you can do in your Swing application to have your menus appear on the global menu bar (in addition to setting the above VM flag):
- Check that you’re running under Apple VM. Use
<font color="darkblue">System.getProperty("os.name")</font>
and check that the value starts with “Mac”.
- Set Aqua (or the future default Apple VM platform look-and-feel) with
<font color="darkblue">UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())</font>
.
- Query and store the following
<font color="darkblue">UIManager</font>
entries: “MenuBarUI”, “MenuUI”, “MenuItemUI”, “CheckBoxMenuItemUI”, “RadioButtonMenuItemUI”, “PopupMenuUI”.
- Set your look-and-feel of preference with
<font color="darkblue">UIManager.setLookAndFeel</font>
call.
- Before creating your first window, restore the
<font color="darkblue">UIManager</font>
entries for the keys specified in the third step.
Now the menus on the fronted frame will go into the global menu bar. It is not recommended to rely on the current class names for the Aqua UI delegates, since the package that hosts these classes is different for different versions of Apple VM. This is mentioned in the release notes for Apple VM 1.6.0 on Mac OS X 10.5 Leopard (radar #4907470).
Here are some Swing links that you might have missed during this week:
- Kaushik Sathupadi writes about implementing mouse gestures in Swing. Personally, i haven’t found mouse gestures to be overly useful until now, but your users might have a different opinion.
- Danny Coward, Ken Russell and Richard Bair host the “Ask the Experts” session this week on 6u10 over at SDN. Last year Two years ago i wasn’t too lucky and my questions were screened out, but things may change this year.
- Michael Gvirtzman has a new Swing application called “Golden Rules”. It allows several planning levels, actual effort tracking, mind mapping, and contact management, providing function-rich goal system for both beginners and professionals and uses SwingX.
- JavaSwing.net has a short tutorial on InputVerifier, including background on relevant scenarios and sample code.
- Business Swing applications don’t have to be ugly (especially if you’re willing to depart from Metal / Ocean), as the new round of Palantir screenshots shows.
- Clemens Eisserer is one of the chosen finalists for the OpenJDK Innovators’ Challenge with his proposal for implementing XRender pipeline for Java2D. You can follow his blog to track the progress, and this week he announced that the project itself will be hosted at java.net.
- Greg Brown has posted the second part of a practical introduction to the new Pivot UI framework.
- Matt Fletcher writes about his experiences in rolling a JRuby desktop application.
- On a related topic, Mario Aquino has two new screencasts on desktop JRuby libraries. The first screencast is on Cheri and the second screencast is on Monkeybars.