Spring effects and widgets - now in Windows look and feel
Posted by kirillcool on March 31, 2007 at 10:11 PM | Comments (10)
In the comments on the entry on spring effects under third-party LAFs, Chris has asked if it would be possible to make this functionality available under the platform's system look and feel. My first response mentioned one possible way to do this - download the sources for JDK, create a custom Ant build script to inject this functionality into core LAFs (such as Windows or Ocean), take the resulting jar and use the boot classpath switch to have JVM load this jar before the classes in rt.jar.
Now, this approach has a few disadvantages:
You inherit all the bugs in the specific com.sun.java.swing.plaf.windows package that you're taking. Any code changes to the core implementation will need to be incorporated into the widgetized binaries.
The size of the resulting jar file will be unnecessarily big, since it will contain the same functionality as the core classes + the injected behaviour.
Application startup scripts will have to be modified to point to the new jar (as boot classpath option).
One big advantage of this approach is that the existing application code (call to UIManager.setLookAndFeel) doesn't need to be changed, since the class name of the main LAF class remains the same.
Well, it so happens that the above approach is not the only way to tackle the request (and no, it's not an April Fools joke). The new laf-widget-windows subproject provides another way to inject widgets, transition layout and image ghosting effects into the core look and feels.
First, here are two screenshots of a sample application under a widgetized Windows look and feel, one under Windows Vista and another under Windows XP. Note the menu search widget, tab overview widget, password strength checker widget and lock widget on uneditable text components:
Here are two Flash movies showing the widgets and the transition
layout in action (under Windows Vista and Windows XP):
Here are two Flash movies showing the ghost effects (rollover icon ghosting and button press ghosting) under Windows Vista and Windows XP:
Here is the code for the only class in this project:
package org.jvnet.lafwidget.windows;
public class WindowsLookAndFeel extends
com.sun.java.swing.plaf.windows.WindowsLookAndFeel {
}
All the rest is taken care of by the custom Ant tasks. This way, all the disadvantages of the first approach are addressed - the code is not tied to a particular implementation of the core LAF, the binaries size is kept to the minimum, and you don't need to change the boot classpath. On the other hand, you now have to use the org.jvnet.lafwidget.windows.WindowsLookAndFeel class as the parameter to pass to UIManager.setLookAndFeel.
Comments are listed in date ascending order (oldest first) | Post Comment
Krill, this is superb work. You know I've gone the "Glass-Pane" route, but I love what you're doing here, it's a really interesting approach and as you've shown, has very little impact on the project itself.
Very interesting, you've taken this further than I thought would be possible.
Posted by: bugfaceuk on April 01, 2007 at 12:51 AM
Excellent work Kirill, I've been hoping you would find a way to get the widgets working with the standard LAF. I look forward to adding a little bit of widget bling to my apps :)
Rob
Posted by: rasto1968 on April 01, 2007 at 01:41 AM
Thanks, Nigel. Rob - let me know how it goes (take a look at the supported client properties).
Posted by: kirillcool on April 01, 2007 at 08:41 PM
Kirill, this is very impressive stuff.
This seems like the right direction for applying fancier effects to Swing applications, which is really needed.
Now, I see you actively participate in discussions with the SwingX project, but are you a member? It would be great if your work was part of that effort, or maybe it's better this way ...
Posted by: augusto on April 02, 2007 at 08:24 AM
Augusto - thanks. To your question - i prefer to be the "boss" of my open-source projects.
Posted by: kirillcool on April 02, 2007 at 02:16 PM
Kirill, that is incredibly cool. After seeing your presentation at Desktop Matters, I was left with the impression that this approach was overly complicated. But I must admit that I'm coming around (I'm slow, but I get there).
I am definitely going to test this out in a project I have coming up soon. Thanks!
Posted by: diverson on April 02, 2007 at 03:17 PM
Dean - the lower you go down the implementation stack, the more flexible (and unfortunately complicated) the implementation becomes. For these types of effects, also check JXLayer from Alex Potochkin that provides much less obtrusive implementation of glasspane-like techniques.
Posted by: kirillcool on April 02, 2007 at 05:32 PM
nice effect but I'm wondering if such animation, in the long run,
could not be irritating especially in a corporate application.
Posted by: florent_garin on April 03, 2007 at 02:44 AM
They could be annoying, but it's great to have the option. Imagine having this and turning it on optionally, your marketing team might just want you to do that for demos.
You still have to study what the usability of your application should be, but I like how kirill's work here seamlessly adds functionality at the laf level. You don't have to add this functionality one by one on all the individual components by hand. Look at the little lock icon one to indicate a non editable field, nothing flashy, but very informative (hopefully the icon can be easily changed).
Posted by: augusto on April 03, 2007 at 05:29 AM
I think that Kirill's techniques are excellent and the entire concept of applying NPR to GUIs is extremely important.
The potential for the UI to increase the efficiency with which they convey information to the end user and scope of the information they convey through the application of NPR s real and largely untapped.
As for any specific technique, they need usability testing or at least some measure of adoption once they've been released into the wild.
We're shortchanging ourselves and leaving value on the table if we think that NPR is not of interest to GUI developers and usability analysts. I feel safe saying that the WIMP interface is not the end of the line for interacting with a computer screen.