This lesson shows you how to use Graphics2D to display graphics with fancy outline and fill styles, transform graphics when they are rendered, constrain rendering to a particular area, and generally control the way graphics look when they are rendered. You'll also learn how to create complex Shape objects by combining simple ones and how to detect when the user clicks on a displayed graphics primitive.
Stroking and Filling Graphics PrimitivesThe first secion in this lesson illustrates how to set the stroke and paint attributes to control the outline and fill styles applied to Shape objects and text.
Transforming Shapes, Text, and ImagesNext you learn how to modify the default transformation so that objects are translated, rotated, scaled, or sheared when they are rendered.
Clipping the Drawing RegionYou can use any shape as a clipping path--the area within which rendering takes place.
Compositing GraphicsAlphaComposite supports different compositing styles. This section illustrates them and shows you how to set the compositing style in the Graphics2D rendering context.
Controlling Rendering QualityThis section describes the rendering hints that Graphics2D supports and shows you how to specify your preference in the trade off between rendering quality and speed.
Constructing Complex Shapes from Geometry PrimitivesUsing Java 2D you can construct complex shapes by performing boolean operations on Shape objects using the Area class.
Supporting User InteractionLearn how to perform hit-detection on graphics primitives.