Even though the AWT includes many different graphics classes, there is one class that is particularly important, that is the
Graphics class.
The
Graphics
class represents an abstract drawing surface called a
graphics context, which is logically equivalent to a piece of paper. Java uses graphics contexts to help abstract the
drawing process. This abstraction allows you to use the same drawing code to draw to different graphical devices such as monitors and printers.
To draw graphics in Java, you must draw them on a graphics context using the
Graphics
class. This drawing typically takes place in an applet's
paint()
method, which is passed a
Graphics
object as its only parameter:
When you draw graphics to the screen, you are really drawing graphics to a component.
A component is a generic window represented by the Component
class that forms the basis for all other graphical elements in the Java AWT.
The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit.
The AWT is part of the Java Foundation Classes (JFC), the standard API for providing a graphical user interface (GUI) for a Java program. AWT is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support AWT.