站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

AWT: The Next Generation - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

AWT: The Next Generation


Last Updated: April 21, 1997

The Abstract Window Toolkit (AWT) is the API responsible for building the graphical user interface (GUI) for Java programs. The AWT is undoubtedly one of the most visible and critical pieces of the Java platform. JavaSoft's goal is to ensure that the AWT meets the increasing demands of developers who are building innovative and competitive products for the Java platform.

The AWT in 1.0 was designed for building GUIs for fairly simple Java applets. It is clear that the AWT must migrate towards providing a framework for more powerful and complex GUI development. We are currently working on this next generation, and it's called The Java Foundation Classes (JFC). We will be rolling out the JFC in phases over the course of the coming year.

The JFC includes many exciting changes and additions to the AWT, including some fairly major architectural enhancements. We know the development community is quickly pushing the envelope of the current 1.0 platform and is anxious to understand our future direction. Therefore, this document provides some high-level information about our direction and you should watch the java.sun.com website for more updates on JFC.

A glimpse at highlights of the next phase...

Swing Set of Components

The peer model in the AWT was designed for the sole purpose of being able to provide a truly native look-and-feel by delegating the look-and-feel of the components to a set of underlying "peer" classes. Each platform has a different set of peer classes to wrap the native system's widgets. While this design works well for its intended goal, it suffers from a number of deficiencies:
  1. Changing the look of components is difficult.
  2. Native widgets behave slightly differently on different platforms. This causes inconsistencies that the AWT must try to alleviate with complex logic.
  3. The peer model provides no option of a common look & feel.
We are currently working on providing "peerless" versions of the AWT UI components, which will be called the "Swing" set of components, and they will all be based on the Lightweight UI Framework introduced in the beta3 release of JDK1.1. In addition to peerless versions of the existing AWT components, this set will also include a much richer array of high-level components (such as TreeView, StyledText, TableView, etc.) because we have heard over and over from developers that they expect to find these in the core toolkit. You can find out more about the Swing APIs in the Swing Overview document.

Pluggable Look-and-Feel

By default, the 1.0 AWT provides a native look-and-feel, determined at runtime, that matches the particular platform it is running on. Because the look-and-feel is truly native, it varies from platform to platform. We've discovered that a large community would like the option of selecting a common look-and-feel across the platforms. We believe the right way to do this is to make this look-and-feel "pluggable", which means that the default look-and-feel of components is delegated to a separate set of look-and-feel objects and rendering functions. The basis of this architecture will allow look-and-feel customization at three levels:
  1. Completely replace the whole look-and-feel by providing a separate look-and-feel implementation.
  2. Customize parts of the the default look-and-feel implementation to provide consistent modifications across components (for example, change the depth of a border's shadow).
  3. Customize the look-and-feel of just an individual component subclass.
Note that this differs from today's peer model in that it is all implemented in Java and all the necessary hooks will be provided to allow easy extending of components. All the new Swing components will be based on this pluggable look-and-feel architecture.

Drag-and-Drop

Drag-and-Drop has become an expected feature of most modern interfaces today. We have been working on a general data transfer architecture, on top of which the API for Clipboard and Drag-and-Drop will be built. We have introduced this data transfer mechanism in JDK 1.1, along with the Clipboard API, and will provide the Drag-and-Drop API in the following release. You can read the Data Transfer design document for more details.

Java 2D

The graphics model in the 1.0 JDK provided only basic rendering capabilities. We realize the need to provide more graphically rich rendering and visual effects. We have been working jointly with major partners on a new Java 2D API that layers into the AWT and dramatically extends its capabilities. This API provides complex rendering that supports arbitrary transformations (rotation, scaling, and so on), image compositing, sophisticated text handling, and more. You can now read more about this API from the Java2D home page.
Copyright © 1996,1997 Sun Microsystems, Inc.
Send feedback to: java-awt@java.sun.com