AWT components, in addition to being image observers, are also capable of creating images. java.awt.Component comes with two methods for creating images:
createImage(int width, int height)
The first version of createImage() creates an image, given an ImageProducer from which the bits of the image are obtained; we will find a use for this method in “Loading Images as Resources”.
The second version creates an image suitable for an offscreen buffer, as we shall discover in “Double Buffering”.
Additionally, the java.awt.Toolkit class is also capable of creating images and provides the following methods:
createImage(byte bits, int offset, int length)