Developers guide

45
5.6 Look and Feel
The Java Language comes with a rich user interface toolkit, the Java Foundation Classes, also
known as JFC-Swing. Swing provides a rich set of widgets
i
and class libraries to build a
professional user interface. One of its key features is the pluggable look and feel framework. This
allows the programmer to dynamically switch between any look and feel. A Look and Feel is a
collection of widget styles, colours, fonts, and input device semantics.
Altering the look and feel servers two purposes. Firstly, for purely aesthetic reasons. Users of the
software can choose a particular colour scheme or theme to suit their mood. Secondly, users
familiar with the behaviour of a particular platform, such as MacOS or Windows, can configure
the look and feel to emulate their environment. This level of customisation makes users more
comfortable with the software.
APT Client GUI Application has been equipped with a Look and Feel menu which allows the user
to switch the look and feel at any time.
5.6.1 Skinned Look and Feel
In addition to the Look and Feel’s supplied with the JDK, many other vendors have implemented
customised Look and Feels. Many of these can be found at the Javootoo website [ 34], which is
designed as a primary reference for Look and Feel developers.
One of the more prominent customised Look and Feel’s available is the Skin Look and Feel from
L2FProd.com. A freely available Look and Feel supporting Skins. Skins use images and other
techniques to drastically enhance the appearance of the GUI components.
Using the code idiom shown in Figure 5-9, the Skin Look and Feel was easily integrated into the
APT Client Application.
/* Skin Look and Feel Usage */
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
...
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePack(
new URL("SkinPackFile.zip”)
)
);
SkinLookAndFeel.enable();
updateComponents();
...
private void updateComponents() {
SwingUtilities.updateComponentTreeUI( rootJFrame);
}
Figure 5-9 Skin Look and Feel usage
i
A user-interface control such as a checkbox or drop-down list