Developers guide

63
8 SkinnedTextField
8.1 Introduction
Given the complex architecture of the APT System, the development of a rich user interface in
Java will require a high level of programming skills and proficiency with the Java Swing
framework.
In order to gain Insight into the internal architecture of Swing itself, I decided to develop a
customised, reusable Swing component, the SkinnedTextField, which uses images, as opposed to
fonts, to render each letter within a text label. This concept is based on the creative images from
Digit Mania[ 36]. It is ideal for displaying the APT telemetry information and is also used in the
Spectrum Scanner application discussed in Chapter 9.
This component can be seamlessly integrated into other Java applications. Particularly
engineering and hardware interfacing systems due to its clear digital readout. The Skins can also
be configured to simulate the real readouts on the hardware itself, enabling unfamiliar users to
quickly identify the semantics of the data.
8.2 Requirements
Dynamic switching of skins
Synchronization without performance degradation
Skin images may be of any size
Not all images within a given skin have to be the same size
8.3 Design
There are four classes used to implement the SkinnedTextField:
SkinnedTextField
This is the component. Created directly by the user. It behaves in much the same way as
a JLabel. More information on its API is included in Figure 8-1
SkinnedTextFieldDemo
Sample code to test and demonstrate SkinnedTextFields
SkinnedTextFieldManager
Currently there is no need for the user to access this class. It keeps track of all the
SkinnedTextField instances and controls the popup menu.
TextSkin
This abstracts the mapping of images to individual characters.