The Source for Java Technology Collaboration
User: Password:



Kirill Grouchnikov

Kirill Grouchnikov's Blog

Borrowing from Vista - part I

Posted by kirillcool on February 27, 2007 at 12:08 AM | Comments (7)

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 <html><b> 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.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • I think it is neat how you can do this kind of stuff. As a feature I'm not a big fan, it draws my eye from the important content (the node) to the appearing lines when my mouse enters the tree.
    I guess I hope I can turn it off when I upgradet to Vista :-)

    Posted by: aronsmith on February 28, 2007 at 12:39 PM

  • Aron - i agree. This can be distracting and this is why it's off by default (in Substance). In Vista you don't get the tree lines, so it's only the expand / collapse icons, and i don't know if you can turn this animation off in Vista.

    Posted by: kirillcool on February 28, 2007 at 12:46 PM

  • We added a nice enhancement to our application performance management console that uses fading for finding execution behavior patterns within a large collection of time series data.

    The Laws of Simplicity: Hide | Highlight

    regards, William

    Posted by: williamlouth on February 28, 2007 at 01:53 PM

  • I tried replacing SyntheticaStandardLookAndFeel with substance and had many errors. I couldn't get the software to run.

    Are you interested in having more feedback? If yes, please send me a message in montechristos gmail. Thanks

    Posted by: montechristos on March 01, 2007 at 03:19 AM

  • Why you've put a Sweden flag on the selected node? Can't it be Brazilian ;)

    Posted by: vecmath on March 03, 2007 at 11:20 AM

  • Please follow the steps to find the bug in your code.
    run Susbstance Test

    step 1. change the progressBar Tabpane
    step 2. change the look and feel to windwos
    step 3. move the slide bar to resize the font.

    Then you will know the look and feel is also changing.

    I am not writing to tell the bug in your code.
    I am facing the strange error with JProgressBar.
    It is perfect at window classic Theme. But if I change
    to window XP Theme, then suddenly
    JProgressBar.setBackground(Color.RED);
    doesn't work. Any idea?


    Posted by: paulseldon on April 11, 2007 at 01:22 PM

  • The tooltip text of the font size slider explicitly states that Substance is set as the default LAF when you change the font size value (this is done since the font settings are Substance-specific API and not available under other LAFs). About your second question - please ask in general Swing forums.
    Thanks, Kirill.

    Posted by: kirillcool on April 11, 2007 at 01:35 PM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds