Sun Java Solaris Communities My SDN Account Join SDN
 
Archive - Java Technology Products Download

Truffle Graphical Toolkit Customization Guide: Introduction

 

Introduction

Previous   |   TOC   |   Next

The Truffle graphical toolkit can be used to develop different look & feel designs for a variety of consumer devices. The Truffle graphical toolkit provides designers with a flexible framework that has most of the functionality necessary to implement a custom look & feel design. This allows consumer device designers to concentrate their efforts on the small amount of code that represents the look & feel itself.

To better understand the Truffle graphical toolkit, you need to see it from different perspectives. The most important is its relationship to the java.awt API.

The Abstract Window Tookit (AWT) is a toolkit for building graphical user-interfaces (GUIs) for Java software. The AWT divides the task of supplying GUI services between high-level GUI classes and platform-level peer components supplied by the underlying platform. Java software interacts only with the high-level GUI classes while the AWT maps these high-level classes to peer components. This architecture allows Java software with GUIs to run on different target platforms without modification.

The Truffle graphical toolkit provides a flexible implementation of the platform-level peer components required by the AWT. To achieve this goal while meeting the needs of different platforms, the Truffle graphical toolkit includes a framework for delivering alternate look & feel designs for different Java application environments.

As an example of a specific look & feel design, the Truffle graphical toolkit includes the Touchable look & feel design for the PJAE operating on touchscreen-based consumer devices. Touchable can be either modified or replaced to support the product identity or product design needs of specific licensees.

The Truffle graphical toolkit does not add any new APIs for application developers to learn. It provides a set of peer components that Java software can use through the standard java.awt API. In addition, the Truffle graphical toolkit includes a special-purpose window and graphics system for platforms that lack a native window and graphics systems.

Definitions

The following list defines some of the important terms in the Truffle vocabulary. Some of these definitions describe how concepts differ between the Truffle context and the desktop context.

Consumer Device
For the purposes of this discussion, a consumer device is a network-connectable device with both a small graphics display and a few simple input devices. A touchscreen would represent a combination of these two requirements. The computing resources (memory, CPU, etc.) should be sufficient to support a Java application environment like the PJAE.

PersonalJava Application Environment (PJAE) API
The PJAE API is derived from the JDK API. For example, version 1.1 of the PJAE API is based on the JDK 1.1.6 API. Some components in the JDK 1.1.6 API are optional in the PJAE API. See the PersonalJava Application Environment Specification for more information on how the PJAE API differs from the JDK API.

In particular, the PersonalJava Application Environment Specification allows an implementation of the PJAE to support a subset of the java.awt API.

Abstract Window Toolkit (AWT)
The AWT is an API for building graphical user-interfaces (GUI) for Java software. It includes high-level GUI classes that are mapped to platform-level peer components through the java.awt.peer interface. For example, java.awt.Button is a high-level class that Java software can use to produce a generic button.

Peer Set
Each implementation of a Java application environment must supply a group of user-interface components, called a peer set, that support the high-level classes of the AWT. Desktop versions of the JDK usually provide peer set implementations through a small amount of Java wrapper code and a set of interface functions based on a platform-specific GUI library. For example, a JDK implementation for a desktop system like the Solaris Operating Environment supplies a font peer component that is mapped to the high-level java.awt.Font class. The Solaris implementation of the JDK uses the Motif library to supply a peer set implementation. The Truffle graphical toolkit supplies a peer set written entirely in the Java programming language.

Truffle Graphical Toolkit
The Truffle graphical toolkit provides both a peer set implementation and a framework for supplying alternate look & feel designs for Java application environments. The Truffle graphical toolkit is written in the Java programming language and includes a special-purpose window and graphics system for platforms that lack a native window system and graphics system.

Look & Feel Design
A look & feel design represents the visual appearance and behavior of a GUI component set. The "look" is based on the graphical design characteristics shared within a GUI component set. For example, a GUI component set might have similar color and border decoration schemes. The "feel" is based on the input mechanisms that a GUI component set provides for a user to interact with. For example, a GUI component set might be based on taking advantage of a touchscreen and provide certain kinds of graphical feedback that is appropriate for a consumer. Look & feel designs vary according to the needs of the target user and the underlying platform. For example, the look & feel designs in Java Foundation Classes (JFC) reflect the needs of enterprise users while Touchable is designed for consumers using touchscreen-based consumer devices like screenphones.

Touchable Look & Feel
The Touchable look & feel design is appropriate for touchscreen-based consumer devices like screenphones. These consumer devices require GUI components that are scaled to use finger or stylus-based input mechanisms.

Java Foundation Classes (JFC)
JFC is a set of GUI components that go beyond the basic set of GUI components provided by the AWT. For example, JFC includes a GUI component called JTree for displaying complex hierarchical data sets. The GUI components in JFC are intended for use by enterprise applications that benefit from large displays. In addition to providing new GUI components JFC includes three different "pluggable" look & feel designs: Motif, Microsoft Windows 95/NT and Metal, the cross-platform Java look & feel design. The look & feel designs in JFC only affect the GUI components in JFC and do not affect the GUI components in the AWT.

Goals

The Truffle graphical toolkit is designed to meet the following goals:
  • Easily customized look & feel designs

  • High portability

  • Low memory footprint

  • I18N support

Source Code Organization

The Truffle graphical toolkit source code is kept in two main directories in the PJAE source tree:
  • src/reference contains the reference source code to the Touchable look & feel design. The Touchable source code can be modified to develop new look & feel designs.

  • src/share/classes/sun contains the source code for OTK (sun.awt.otk) and the graphics system and the window system. The source code in src/share/classes/sun cannot be modified to develop new look & feel designs.
Previous   |   TOC   |   Next

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.