Java Reference
In-Depth Information
BasicStroke
declares several constructors including
BasicStroke(float
width, int cap, int join, float miterlimit, float[] dash,
float dash_phase)
,whichgivesyoucomplete controloverastroke'scharacter-
istics,andtheshorter
BasicStroke(float width, int cap, int join)
constructor, which strokes a solid line.
Graphics2DAttribDemo
demonstrates both constructors along with pen width,
endcaps,joinstyles,miterlimit,anddashattributes.Thesecharacteristicsareshownin
Figure 7-19.
Select Stroke from the Demo menu to view the stroke demonstration.
Font
Graphics2D
inherits (from
Graphics
)
void setFont(Font font)
for set-
tingthefontattributetothespecified
Font
object.Call
Font getFont()
(alsoin-
herited from
Graphics
) to return the current font.
Figure 7-20
shows the Arial font's plain, bold, italic, and bold plus italic styles.