In few steps, you will learn how to include SkinLF in your applications or applets.
The first step is to choose your skins
There are a lot of skins available at www.themes.org. If you plan to use SkinWindow or JInternalFrame in your applications, you must select a GTK and a KDE skin (or theme). See the theme support matrix for more information on theme support.
Then uncompress the GTK and/or KDE theme archive
Update your code to use Skin Look And Feel
To compile and run applications, you will need to add skinlf.jar in your CLASSPATH. Here is a code snippet that shows how to call Skin Look And Feel:
import com.l2fprod.gui.plaf.skin.Skin;
import com.l2fprod.gui.plaf.skin.CompoundSkin;
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
// the main method requires one or two arguments (theme filenames)
public static void main(String[] args) {
Skin skin = null;
// the SkinLookAndFeel.loadSkin tries to determine
// if the theme is GTK (gtkrc) or KDE (ends with .themerc)
// by looking at the filename.
// You can also use GtkSkin or KdeSkin classes.
if (args.length > 1)
// two skins are provided on the command line
// create a CompoundSkin.
// If a feature is not supported by the first Skin,
// the second will be used
skin = new CompoundSkin(SkinLookAndFeel.loadSkin(args[0]),
SkinLookAndFeel.loadSkin(args[1]));
else
skin = SkinLookAndFeel.loadSkin(args[0]);
// set the skin
SkinLookAndFeel.setSkin(skin);
// ask Swing to use Skin Look And Feel
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
// or UIManager.setLookAndFeel(new SkinLookAndFeel());
// your code here
}
|
Start your application
java -classpath <myclasspath>:skinlf.jar MyApplication \
themes\Cool\gtk\gtkrc themes\Quick\quick.themerc
|
That's it !
|