Graphics Attributes
The Graphics
class
provides operations that let you do the following:
Draw straight lines, arcs, and rectangles
Fill the space occupied by an arc or a rectangle
Render images
Draw text presented in the form of a
Stringor as character data
All these operations use a coordinate system to indicate at least
their starting point, and most of them also use one or more
attributes of the Graphics object that act as
implicit parameters. When the paint( ) method is
called, the attributes of the Graphics object that
is passed to it have well-defined values that can be modified if
necessary. The attributes and their initial values are listed in
Table 5-1. A more detailed description of each
attribute and the way in which it is used are found in later
sections.
Table 5-1. Graphics Attributes
|
Attribute |
Use |
Initial Value |
|---|---|---|
|
Clip |
The clip sets the region of the |
Depends on the reason |
|
Color |
The color that will be used when drawing or filling shapes or rendering text. See Section 5.3.2 for further details. |
Black |
|
Font |
The font used when rendering text. Fonts are discussed in Section 5.8. |
Set to the platform’s default font |
|
Stroke Style |
Determines whether lines, rectangles, and arcs are drawn using solid or dotted strokes, as described in Section 5.4.1. |
Set to draw a solid line |
|
Origin |
The position of the coordinate point (0, 0) relative to the top left ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access