【正文】
Dialog, and Frame. Best of all possible approaches Swing does not pletely follow the Java language as a platform route. Instead, it bines the best of both approaches by offering a bridge back to the native platforms. The mechanism for establishing this bridge is referred to as Pluggable LookandFeels (which is pretty close to the concept of themes, popular in the Linux munity). Each Swing ponent has a model of its functionality and a separate appearance (the lookandfeel), which can be set in advance or changed on the fly. Swing provides a Java lookandfeel (previously known as Metal), separate ones for the Windows and Motif platforms, and one for the Macintosh platform (as an extra option). The platform lookandfeels don39。t use the native ponents of the platform like the AWT does. Instead, they use lightweight ponents that are drawn to have the same appearance as the native ponents. This is good for functionality, but there are always some differences in look or behavior, so plex interfaces will never be identical to ones that use native ponents. Furthermore, you can roll your own lookandfeel, which is a great ability to have when crafting one for highly specialized applications or when providing a corporate lookandfeel across a range of applications. Platformindependent drag and drop JDK added a general mechanism, found in the package, that enabled the transferring of data between and within applications, as well as the ability to manipulate the system clipboard. The package was introduced in the Java 2 version. This package builds on the datatransfer mechanism by providing draganddrop facilities that can operate in a platformindependent manner within a single Java application or between two Java applications. It can also behave in a platformdependent manner in order to integrate with the draganddrop facilities of the native platform. The Drag and Drop (DND) API is quite challenging to use because it operates at a high level of abstraction to support the different ways in which it can work and because it is designed to operate on arbitrary datatypes, as specified by the interface. Let39。s take a look at an example. Enabling the disabled: Accessibility The JFC Accessibility API equips Java applications so they can be accessed by users of all abilities, including people with sight, hearing, or dexterityrelated difficulties. These might include the inability to discern visible or auditory cues or to operate a pointing device. Two of the most important features of accessibility support are screen readers and magnifiers. Screen readers allow users to interact with a GUI by creating an offscreen representation of the interface and passing this to a speech synthesizer or a Braille terminal. Screen magnifiers provide an enlarged window of the screen, typically from 2 to 16 times the normal size. They generally keep track of pointer movements and changes in input focus and adjust the enlarged view accordingly. In addition, techniques such as font smoothing may be used to create a clearer picture. The Java Accessibility Bridge Some host systems, such as Microsoft Windows, provide their own accessibility features. By default, Java applications do not fully support them. For example, with native applications the screen magnifier detects when the input focus is switched to a different user interface ponent, such as by using the Tab key, and it adjusts the portion of the screen that is being magnified to show the ponent that now has the input focus. However, Swing applications use lightweight ponents, which are treated as images by the ope