public class Pen
extends java.lang.Object
implements java.io.Externalizable
Constructor and Description |
---|
Pen()
Initializes a new instance of the
Pen class. |
Pen(Brush brush,
double width)
Initializes a new instance of the
Pen class. |
Pen(Brush brush,
double width,
DashStyle dashStyle)
Initializes a new instance of the
Pen class. |
Pen(java.awt.Color color)
Initializes a new instance of the
Pen class. |
Pen(java.awt.Color color,
double width)
Initializes a new instance of the
Pen class. |
Pen(java.awt.Color color,
double width,
DashStyle dashStyle)
Initializes a new instance of the
Pen class. |
Modifier and Type | Method and Description |
---|---|
void |
applyTo(java.awt.Graphics2D g)
Sets the pen as the current pen for the specified Graphics2D object.
|
void |
applyTo(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D bounds)
Sets the pen as the current pen for the specified Graphics2D object.
|
Pen |
clone()
Creates a copy of this pen.
|
Brush |
getBrush()
Gets the color of this pen.
|
int |
getCap() |
java.awt.Color |
getColor()
Gets the color of this pen.
|
DashStyle |
getDashStyle()
Gets the dash style of this pen.
|
double |
getEffectiveWidth(java.awt.Graphics2D g2d)
Gets the effective width of the lines drawn with this pen once it has been applied to a Graphics2D object.
|
int |
getLineJoin()
Gets the line join.
|
float |
getMiterLimit()
Gets the miter limit
|
double |
getWidth()
Gets the width of the lines drawn with this pen.
|
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
void |
reset(java.awt.Color color,
double width,
DashStyle dashStyle) |
void |
setBrush(Brush value)
Gets the color of this pen.
|
void |
setCap(int value) |
void |
setColor(java.awt.Color value)
Sets the color of this pen.
|
void |
setDashStyle(DashStyle value)
Sets the dash style of this pen.
|
void |
setLineJoin(int value)
Sets the line join.
|
void |
setMiterLimit(float miterLimit)
Sets the miter limit
|
void |
setWidth(double value)
Sets what the width of the lines drawn with this pen should be.
|
java.awt.Color |
toColor() |
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable.
|
public Pen()
Pen
class.public Pen(java.awt.Color color)
Pen
class.color
- A Color object representing the pen color.public Pen(java.awt.Color color, double width)
Pen
class.color
- A Color object representing the pen color.width
- A double value representing the pen width.public Pen(Brush brush, double width)
Pen
class.
Instances of the Pen class created using this constructor
are currently not serialised.brush
- A Brush
object representing the pen color.width
- A double value representing the pen width.public Pen(java.awt.Color color, double width, DashStyle dashStyle)
Pen
class.color
- A Color object representing the pen color.width
- A double value representing the pen width.dashStyle
- A DashStyle
object representing the pen's dash pattern.public void applyTo(java.awt.Graphics2D g)
public void applyTo(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
public Pen clone()
clone
in class java.lang.Object
Pen
object.public double getEffectiveWidth(java.awt.Graphics2D g2d)
public Brush getBrush()
Brush
object representing the pen color.public void setBrush(Brush value)
value
- A Brush
object representing the pen color.public java.awt.Color getColor()
public void setColor(java.awt.Color value)
value
- A Color object representing the pen color.public double getWidth()
public void setWidth(double value)
value
- A double value representing the pen width.public DashStyle getDashStyle()
DashStyle
object representing the pen's dash pattern.public void setDashStyle(DashStyle value)
value
- A DashStyle
object representing the pen's dash pattern.public int getCap()
public void setCap(int value)
public int getLineJoin()
public void setLineJoin(int value)
public void setMiterLimit(float miterLimit)
public float getMiterLimit()
public void reset(java.awt.Color color, double width, DashStyle dashStyle)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public java.awt.Color toColor()