About the element Package

Java is, at best, a difficult language to learn if one must dive head first. The package used with this text, the element package is responsible for insulating students from the difficulites of using the AWT (Abstract Windowing Toolkit) from day one. Still, the design of the package is such that students who learn Java by using the package will not be left high-and-dry once they must turn to direct use of the AWT.

The element package provides several items:

  1. A class that supports a window for generic drawing.
  2. A class that supports, in a consistent manner, a window for performing input and output.
  3. A heirarchy of classes that support graphics in a drawing window.

The latter feature is supported with a small set of graphics primitives, including Point, Line, Circle, Rect, and others. Each implements an interface, Drawable, which may be implemented by the programmer to extend the features and capabilities of the element package itself. For example, the text spends some time discussing the implementation of a class to draw Triangles and Squares.