Graphics Tutorial Examples

Concept Description
graphics context a graphics context is a drawing surface such as a component's display area, a print page, an offscreen image buffer
java.awt.Graphics2D this is a graphics context and is usually obtained from the parameter in a component's paint() method, or directly from an offscreen image buffer
rendering rendering is the process of representing shapes, text, images as pixels on a graphics context using methods to apply the Graphics2D properties below
paint paint - the color or pattern that will be used to fill a shape
stroke stroke - specifies how to draw the outline of a shape e.g. thickness
font font - determines how characters are rendered to create appropriate shapes
transformation transformation - before rendering, shapes, text, and images can be geometrically transformed by being moved , rotated, scaled, sheared
composite a compositing rule determines how colors combine on the drawing surface by, for example, making parts of the surface partially or completely transparent
clipping shape the clipping shape is a defined area in which rendering takes place (normally the rectangular area of a component or image)
rendering hints rendering hints specify what tradeoff to use in visual quality and rendering speed

Example programs for each of the above concepts are provided in sequence in the list to the left.