|
Code Samples Index
These code examples and other materials are subject to Sun Microsystems, Inc.
Legal Terms
Changing the Thickness of the Stroking Pen
dashPhase is the offset to start the dashing pattern.
float strokeThickness = 5.0f;
// A solid stroke
BasicStroke stroke = new BasicStroke(strokeThickness);
g2d.setStroke(stroke);
drawShape(g2d);
// A dashed stroke
float miterLimit = 10f;
float[] dashPattern = {10f};
float dashPhase = 5f;
stroke = new BasicStroke(
strokeThickness, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, miterLimit,
dashPattern, dashPhase);
g2d.setStroke(stroke);
drawShape(g2d);
|
Examplets provided by permission of the publisher, Addision-Wesley,
and Author Patrick Chan.
Order this book from Amazon
|