Java Reference
In-Depth Information
TOPIC
CONCEPT
Device Con-
texts
An object of the Graphics or Graphics2D type encapsulates device context. You use the device context
for a component to draw on the component.
Affine Trans-
forms
The
AffineTransform
class defines an affine transformation that can be applied to a graphics context. A
Graphic2D
object always contains an
AffineTransform
object, and the default transform leaves co-
ordinates unchanged.
Transforming
Coordinates
The transform for a graphics context applies to the user coordinate system and is applied immediately
before the user coordinates for a shape you are drawing are converted to device coordinates.
Types of
Transforms
You can create four kinds of transforms: translations, rotations, scaling, and shearing. You can combine
any number of transforms in a single
AffineTransform
object.
Color
Choosers
The
JColorChooser
class encapsulates panes you can incorporate into a dialog to allow a color to be
chosen. The class also provides static methods that create and display predefined dialogs for choosing a
color.