TOC PREV NEXT INDEX




Creating a Skinned GUI


This section gives an example of how to create a skinned GUI using the default SkinManager bean and a SkinnableButton bean. The skin of a SkinnableButton supports the following four images. These map to the different states of a component:

If a new SkinManager is not created, the SkinnableButton uses the default SkinManager.

For example, a back button has the following properties:

Property
Definition
skin
backButton
skinManager
This property is not set. It uses the default skinManager.

The default SkinManager has the following properties:

Property
Default Value
directory
Empty
package
/ice/ri/enhancedawt/skins
skinPack
default

Note: Since no directory is set in the default SkinManager, it only attempts to load images from the classpath. Images must be on the classpath in the IDE and at run-time before loading can occur. Resources can be loaded from the classpath using a directory-based file system or a zip file.

To create a skin for the SkinnableButton, the four images are structured as follows:

/ice/ri/enhancedawt/skins/default/backButton/

    normal.gif

    pressed.gif

    highlighted.gif

    disabled.gif


 

This directory tree is packaged into a JAR file called defaultSkinPack.jar and added to the classpath.

Next, a SkinnableButton is created and added to a SkinnablePanel. This example does not include the configuration of the SkinnablePanel.

The skin property of SkinnableButton is set to backButton, and its skinManager property is left blank. The default SkinManager loads the skin for the SkinnableButton from defaultSkinPack.jar on the classpath. It looks for this skin at the following location:

/ice/ri/enhancedawt/skins/default/backButton/{the four images}

This is necessitated by the default SkinManager, which looks in the package /ice/ri/enhancedawt/skins and loads skins from the default skinPack. The SkinnableButton provides the remaining information during the skin loading process. This information is the backButton skin property, and the names of the four images that should be loaded.



Copyright 2005. ICEsoft Technologies, Inc.
http://www.icesoft.com

TOC PREV NEXT INDEX