Switching Look and Feel
There is an interesting article at Swing Connection (http://java.sun.com/products/jlf/updates/switching.html) for developers building Swing applications allowing the user to change the look and feel "on the fly":
"There is no special provision in the Java Foundation Classes itself to allow users to select a look and feel "on the fly." The look and feel switching provided in many of the JFC demos helps show some of the power of the JFC. It is important to note that ensuring complete on the fly look and feel switching was not a core design goal for JFC. As a result, there is no guarantee that user interfaces designed properly in one look and feel will migrate cleanly to another look and feel."
It is not recommended to switch look and feel at runtime, you should ask the user to restart the application. But with SkinLF, changing skins or theme packs at runtime is supported.
SkinLF and Linux
If your application is running on a Linux platform, you can use the LinuxLookAndFeel (com.l2fprod.gui.plaf.skin.LinuxLookAndFeel) bundled with SkinLF. LinuxLookAndFeel extends SkinLookAndFeel and tries to guess the GTK theme selected by the user.
SkinLF as default look and feel
Swing allows the user to choose a default look and feel. When Swing initializes the look and feel, it first looks in a file named swing.properties located in <jre.home>/lib (will be <java.home>/jre/lib with a JDK) for the property swing.defaultlaf. You can set this property to com.l2fprod.gui.plaf.skin.SkinLookAndFeel.
#swing.properties file
swing.defaultlaf=com.l2fprod.gui.plaf.skin.SkinLookAndFeel
|
By using this feature, we are not able to provide SkinLF with a theme pack (or skins) to load. When SkinLF starts, it will try to load the user theme pack: <user.home>/.skinlf/themepack.zip
|