Skip to main content

Borrowing from Vista - part I

Posted by kirillcool on February 27, 2007 at 12:08 AM PST

Windows Vista was released a few weeks ago, and it brings a sophisticated Aero user interface. I've just bought a brand new laptop with Vista on it, and i must say that Aero brings a substantial improvement in the UI experience (note to all Mac users - this is not a comparison between Mac and Windows, so there's no need for flamewars in the comments).

So i've installed my development environment on the laptop, including Eclipse and JDK 6.0u1 and had quite a few hours on them. One of the things that kind of "bothered" me was the Package Explorer view in Eclipse - the tree collapse / expand icons were constantly appearing and disappearing. It took me a few minutes to understand what's happening - when the mouse leaves the tree, these icons fade out and disappear, to reappear when the mouse enters the tree. On one hand this was kind of irritating at the beginning (i thought it was a UI bug, and there are some cases where you have to explicitly click outside the tree to make the icons disappear), but on the other hand it makes the overall UI less cluttered.

Following my experimentations on sliders and scroll bars, the latest development drop of Substance contains an option to have this effect on the trees (see the WebStart link below).

The new SubstanceLookAndFeel.TREE_DECORATIONS_ANIMATION_KIND fade kind is used to "describe" this animation effect. This is turned off by default (to provide backwards visual compatibility) and can be turned on using the following two APIs:

  /**

   * Allows fade of the specified kind on all controls.

   

   @param fadeKind

   *            Fade kind to allow.

   */

  public synchronized void allowFades(FadeKind fadeKind)



  /**

   * Allows fade of the specified kind on the specified control.

   

   @param fadeKind

   *            Fade kind to allow.

   @param comp

   *            Control for allowing the fade kind.

   */

  public synchronized void allowFades(FadeKind fadeKind, Component comp)

These two are available in the org.jvnet.lafwidget.utils.FadeConfigurationManager class. The first can be used to enable the tree decorations animation on all trees (globally) while the second can be used to enable the tree decorations animation on the specific tree. Here is how it looks at runtime:

In order to see this functionality in a WebStart demo, click the button below, wait for the application to load, go to the "Tree" tab, select the "animate tree decorations" checkbox in the left task pane and move the mouse over the tree and away from it (and let me know if you see any bugs):



In addition, i finally had some chance to see the new Windows look and feel. It looks really good, reproducing the look of almost all components and having animations on the more common controls (buttons, check boxes, radio buttons etc). There is some work still left to be done (animations on progress bars, menus, etc), and still some more work to be done on trees. Here is how the native tree looks like (the mouse is hovering over the "build" folder - see the glowing icon):

And here is how a tree (with no custom icons) looks like under Mustang u1 latest weekly drop:

dmsmall.jpg Here, the Swing Windows LAF loses (for now) to SWT which has native icons, animations and (lack of) tree lines. In addition, the selected tree node doesn't show any text - the custom tree renderer uses HTML to wrap the text in tags (this works correctly in Metal and Substance). Last but not least, i'd like to remind you that i will be presenting a small session at Desktop Matters conference which will take place on March 9th in San Jose. If you're interested in one long all-desktop day, you're welcome to register and participate.