All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.BasicStroke

java.lang.Object
    |
    +----java.awt.BasicStroke

public class BasicStroke
extends Object
implements Stroke
Defines a basic set of rendering attributes for stroked graphics primitives. These attributes describe the shape of a pen drawn along the trajectory of the path and the decorations applied where path segments are joined and where they begin and end. These attributes include:
width
The width of the pen measured perpendicular to its trajectory.
end caps
The decoration of the path where line segments begin and end.
line joins
The decoration of the path between connected line segments.
dash attributes
The definition of how to make a dash pattern along the trajectory of the path by creating new segments which alternate between opaque and transparent sections.


Variable Index

 o CAP_BUTT
End unclosed subpaths and dash segments with no added decoration.
 o CAP_ROUND
End unclosed subpaths and dash segments with a round decoration with radius equal to half of the line width.
 o CAP_SQUARE
End unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.
 o JOIN_BEVEL
Join line segments by connecting the outer corners of their wide outlines with a straight segment.
 o JOIN_MITER
Join line segments by extending their outside edges until they meet.
 o JOIN_ROUND
Join line segments by rounding off the corner at a radius of half the line width.

Constructor Index

 o BasicStroke()
Construct a new stroke with defaults for all attributes.
 o BasicStroke(float, int, int)
Construct a new stroke with the specified attributes, but no dashing.
 o BasicStroke(float, int, int, float)
Construct a new stroke with the specified attributes, but no dashing.
 o BasicStroke(float, int, int, float, float[], float)
Construct a new stroke with the specified attributes.

Method Index

 o createStrokedShape(Shape)
Returns a shape whose interior defines the stroked outline of a given shape.
 o equals(Object)
Compares two Objects for equality.
 o getDashArray()
Return the array representing the lengths of the dash segments.
 o getDashPhase()
Returns the dash phase.
 o getEndCap()
Returns the end cap style.
 o getLineJoin()
Returns the line join style.
 o getLineWidth()
Returns the line width.
 o getMiterLimit()
Returns the limit of miter joins.

Variables

 o JOIN_MITER
public static final int JOIN_MITER
Join line segments by extending their outside edges until they meet.

 o JOIN_ROUND
public static final int JOIN_ROUND
Join line segments by rounding off the corner at a radius of half the line width.

 o JOIN_BEVEL
public static final int JOIN_BEVEL
Join line segments by connecting the outer corners of their wide outlines with a straight segment.

 o CAP_BUTT
public static final int CAP_BUTT
End unclosed subpaths and dash segments with no added decoration.

 o CAP_ROUND
public static final int CAP_ROUND
End unclosed subpaths and dash segments with a round decoration with radius equal to half of the line width.

 o CAP_SQUARE
public static final int CAP_SQUARE
End unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.

Constructors

 o BasicStroke
public BasicStroke(float width,
                   int cap,
                   int join,
                   float miterlimit,
                   float[] dash,
                   float dash_phase)
Construct a new stroke with the specified attributes.

Parameters:
width - The width of the stroke.
cap - The style of the ends of a stroke.
join - The style to join strokes together.
miterlimit - The limit to trim the miter join.
dash - The array representing the dashing pattern.
dash_phase - The offset to start the dashing pattern.
 o BasicStroke
public BasicStroke(float width,
                   int cap,
                   int join,
                   float miterlimit)
Construct a new stroke with the specified attributes, but no dashing.

Parameters:
width - The width of the stroke.
cap - The style of the ends of a stroke.
join - The style to join strokes together.
miterlimit - The limit to trim the miter join.
 o BasicStroke
public BasicStroke(float width,
                   int cap,
                   int join)
Construct a new stroke with the specified attributes, but no dashing. The miter limit parameter is unnecessary in cases where the default is allowable or the line joins are not specified as JOIN_MITER.

Parameters:
width - The width of the stroke.
cap - The style of the ends of a stroke.
join - The style to join strokes together.
 o BasicStroke
public BasicStroke()
Construct a new stroke with defaults for all attributes. The default attributes are a line width of 1.0, CAP_SQUARE, JOIN_MITER, a miter limit of 10.0, and no dashing.

Methods

 o createStrokedShape
public Shape createStrokedShape(Shape s)
Returns a shape whose interior defines the stroked outline of a given shape.

Parameters:
s - The shape whose boundary should be stroked.
Returns:
The shape of the stroked outline.
See Also:
createStrokedShape
 o getLineWidth
public float getLineWidth()
Returns the line width. Line width is represented in user space.

Returns:
The line width of the stroke.
 o getEndCap
public int getEndCap()
Returns the end cap style.

Returns:
The end cap style of the stroke.
 o getLineJoin
public int getLineJoin()
Returns the line join style.

Returns:
The line join style of the stroke.
 o getMiterLimit
public float getMiterLimit()
Returns the limit of miter joins.

Returns:
The limit of miter joins.
 o getDashArray
public float[] getDashArray()
Return the array representing the lengths of the dash segments. Alternate entries in the array represent the user space lengths of the opaque and transparent segments of the dashes. As the pen moves along the path to be stroked, the user space distance that the pen travels will be accumulated to index into the dash array. The pen will be opaque when its current cumulative distance maps to an odd element of the dash array and transparent otherwise.

Returns:
The dash array.
 o getDashPhase
public float getDashPhase()
Returns the dash phase. The dash phase is a user space distance that is used to initialize the path distance accumulation variable before the first segment of the first subpath is stroked.

Returns:
the dash phase.
 o equals
public boolean equals(Object obj)
Compares two Objects for equality.

Overrides:
equals in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature