Java Reference
In-Depth Information
The Java Foundation Classes
Graphics programming in Java is by means of packages called the Java
Foundations Classes . In Java 1.2 the foundations classes include the fol-
lowing APIs:
1. Abstract Windows Toolkit or AWT
2. Swing components
3. Java 2D
4. Java accessibility
Of these, the Java Accessibility API package supports handicap
assistive technologies such as screen readers, screen magnifiers, etc. The
classes that more directly relate to conventional graphics (AWT, Swing,
and Java 2D) are briefly discussed in the following sections.
AWT
TheAbstractWindowsToolkit(AWT)isthecorepackageforimplementing
graphics.TheAWTcontainsclassesforcreatingandoperatingaGraphical
UserInterfaceandforperformingdrawingandpaintingoperations.Inaddi-
tion,thecurrentversionsoftheAWTprovidesupportforclipboard-based
transfers, for image manipulations, fonts, printing, 2D geometrical opera-
tions, input, and provides an event handling mechanism.
One of the most useful classes of the AWT is java.awt.Component. A
component can be a button, a menu, a scrollbar, or any graphical element
that is displayed on the screen and that can interact with the user. In
Microsoft Windows components are called controls . The Component
class is currently extended by sixty-six classes.
Swing
ThedesignersoftheAWTdecidedtousethefunctionalityoftheunderlying
operatingsystemsinsteadofcodingtheuserinterfacetoolkitfromscratch.
Forthisreason,theAWTisactuallyathinsoftwarelayerthatprovidesac-
cess to the system's application programming interface. The underlying
code that provides the specific windowing functions are called peer
classes .Forexample,ifaJavaapplicationusestheAWTtocreateabutton
control, the resulting component would be a standard Windows button, a
Macintosh button, or a Motif button according to the operating system on
which the application executes.
Search WWH ::




Custom Search