|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.BasicStroke
public class BasicStroke
A general purpose Stroke
implementation that can represent a wide
variety of line styles for use with subclasses of Graphics2D
.
The line cap and join styles can be set using the options illustrated here:
A dash array can be used to specify lines with alternating opaque and transparent sections.
Field Summary | |
---|---|
static int |
CAP_BUTT
Indicates a flat line cap style. |
static int |
CAP_ROUND
Indicates a rounded line cap style. |
static int |
CAP_SQUARE
Indicates a square line cap style. |
static int |
JOIN_BEVEL
Indicates a bevelled line join style. |
static int |
JOIN_MITER
Indicates a mitered line join style. |
static int |
JOIN_ROUND
Indicates a rounded line join style. |
Constructor Summary | |
---|---|
BasicStroke()
Creates a new BasicStroke instance. |
|
BasicStroke(float width)
Creates a new BasicStroke instance with the given line
width. |
|
BasicStroke(float width,
int cap,
int join)
Creates a new BasicStroke instance with the given attributes. |
|
BasicStroke(float width,
int cap,
int join,
float miterlimit)
Creates a new BasicStroke instance with the given attributes. |
|
BasicStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dashPhase)
Creates a new BasicStroke instance with the given attributes. |
Method Summary | |
---|---|
Shape |
createStrokedShape(Shape s)
Creates a shape representing the stroked outline of the given shape. |
boolean |
equals(Object o)
Compares this BasicStroke for equality with an arbitrary
object. |
float[] |
getDashArray()
Returns the dash array, which defines the length of alternate opaque and transparent sections in lines drawn with this stroke. |
float |
getDashPhase()
Returns the dash phase for the stroke. |
int |
getEndCap()
Returns a code indicating the line cap style (one of CAP_BUTT ,
CAP_ROUND , CAP_SQUARE ). |
int |
getLineJoin()
Returns a code indicating the line join style (one of JOIN_BEVEL ,
JOIN_MITER or JOIN_ROUND ). |
float |
getLineWidth()
Returns the line width. |
float |
getMiterLimit()
Returns the miter limit. |
int |
hashCode()
Returns the hash code for this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int JOIN_MITER
public static final int JOIN_ROUND
public static final int JOIN_BEVEL
public static final int CAP_BUTT
public static final int CAP_ROUND
public static final int CAP_SQUARE
Constructor Detail |
---|
public BasicStroke(float width, int cap, int join, float miterlimit, float[] dash, float dashPhase)
BasicStroke
instance with the given attributes.
width
- the line width (>= 0.0f).cap
- the line cap style (one of CAP_BUTT
,
CAP_ROUND
or CAP_SQUARE
).join
- the line join style (one of JOIN_ROUND
,
JOIN_BEVEL
, or JOIN_MITER
).miterlimit
- the limit to trim the miter join. The miterlimit must be
greater than or equal to 1.0f.dash
- The array representing the dashing pattern. There must be at
least one non-zero entry.dashPhase
- is negative and dash is not null.
IllegalArgumentException
- If one input parameter doesn't meet
its needs.public BasicStroke(float width, int cap, int join, float miterlimit)
BasicStroke
instance with the given attributes.
width
- the line width (>= 0.0f).cap
- the line cap style (one of CAP_BUTT
,
CAP_ROUND
or CAP_SQUARE
).join
- the line join style (one of JOIN_ROUND
,
JOIN_BEVEL
, or JOIN_MITER
).miterlimit
- the limit to trim the miter join. The miterlimit must be
greater than or equal to 1.0f.
IllegalArgumentException
- If one input parameter doesn't meet
its needs.public BasicStroke(float width, int cap, int join)
BasicStroke
instance with the given attributes.
The miter limit defaults to 10.0
.
width
- the line width (>= 0.0f).cap
- the line cap style (one of CAP_BUTT
,
CAP_ROUND
or CAP_SQUARE
).join
- the line join style (one of JOIN_ROUND
,
JOIN_BEVEL
, or JOIN_MITER
).
IllegalArgumentException
- If one input parameter doesn't meet
its needs.public BasicStroke(float width)
BasicStroke
instance with the given line
width. The default values are:
CAP_SQUARE
;JOIN_MITER
;10.0f
.
width
- the line width (>= 0.0f).
IllegalArgumentException
- If width
is negative.public BasicStroke()
BasicStroke
instance. The default values are:
1.0f
;CAP_SQUARE
;JOIN_MITER
;10.0f
.
Method Detail |
---|
public Shape createStrokedShape(Shape s)
createStrokedShape
in interface Stroke
s
- the shape.
public float getLineWidth()
public int getEndCap()
CAP_BUTT
,
CAP_ROUND
, CAP_SQUARE
).
public int getLineJoin()
JOIN_BEVEL
,
JOIN_MITER
or JOIN_ROUND
).
public float getMiterLimit()
public float[] getDashArray()
null
, a continuous line will be drawn.
null
).public float getDashPhase()
getDashArray()
is
rendered.
public int hashCode()
int
first with
Float.floatToIntBits()
if the value is a
float
).
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)
public boolean equals(Object o)
BasicStroke
for equality with an arbitrary
object. This method returns true
if and only if:
o
is an instanceof BasicStroke
;o
.
equals
in class Object
o
- the object (null
permitted).
true
if this stroke is equal to o
and
false
otherwise.Object.hashCode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |