public class Pen
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Pen.TextInfo
Text information.
|
Modifier and Type | Field and Description |
---|---|
static java.awt.Font |
DEFAULT_FONT
The default font that is used when drawing text.
|
Constructor and Description |
---|
Pen()
Constructor with standard pen color (black) and and standard Stroke.
|
Pen(java.awt.Color color)
Constructor with given
color and standard Stroke. |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getAvailableFontFamilies()
Provides information about the currently available font families (e.g.
|
java.awt.Color |
getColor()
Queries the
Pen s color. |
float[] |
getDashArray()
Queries the
Pen s dash array. |
float |
getDashPhase()
Queries the
Pen s dash phase. |
int |
getEndCap()
Queries the
Pen s end cap style. |
java.awt.Color |
getFillColor()
Queries the
Pen s fill color. |
java.awt.Font |
getFont()
Queries the current font.
|
int |
getFontSize()
Queries the size (in points, rounded to int) of the current font.
|
int |
getLineJoin()
Queries the
Pen s line join style. |
float |
getLineWidth()
Queries the
Pen s line width |
float |
getMiterLimit()
Queries the
Pen s miter limit style. |
java.awt.Stroke |
getStroke()
Gets the
Pen s Stroke |
int |
getTextAscent()
Returns ascender height of text with current font (in pixels).
|
int |
getTextDescent()
Returns descender height of text with current font (in pixels).
|
int |
getTextHeight()
Returns height of text with current font (in pixels).
|
static Pen.TextInfo |
getTextInfo(java.lang.String text,
java.awt.Font font)
Returns text information for given font and text.
|
int |
getTextWidth(java.lang.String text)
Returns width of given text with current font (in pixels).
|
void |
setColor(java.awt.Color color)
Sets the
Pen s color. |
void |
setDash(float[] dashArray)
Sets the
Pen s dash array. |
void |
setDashPhase(float dashPhase)
Sets the
Pen s dash phase. |
void |
setEndCap(int endCap)
Sets the
Pen s end cap style. |
void |
setFillColor(java.awt.Color color)
Sets the
Pen s fill color. |
void |
setFont(java.awt.Font f)
Changes the font to the given one.
|
void |
setFontSize(float size)
Changes the font size (in points).
|
void |
setFontSize(int size)
Changes the font size (in points).
|
void |
setFontStyle(int style)
Changes the font style.
|
void |
setLineJoin(int join)
Sets the
Pen s line join style. |
void |
setLineWidth(float width)
Sets the
Pen s line width. |
void |
setMiterLimit(float miterlimit)
Sets the
Pen s miter limit. |
public static java.awt.Font DEFAULT_FONT
for more information, e.g. on font styles.
public Pen()
BasicStroke
public Pen(java.awt.Color color)
color
and standard Stroke.
Fill color same as pen color,BasicStroke
public java.awt.Color getColor()
Pen
s color.public void setColor(java.awt.Color color)
Pen
s color.public void setFillColor(java.awt.Color color)
Pen
s fill color.public java.awt.Color getFillColor()
Pen
s fill color.public java.awt.Stroke getStroke()
Pen
s Stroke
BasicStroke
,
Stroke
public float getLineWidth()
Pen
s line widthpublic int getEndCap()
Pen
s end cap style.BasicStroke
public int getLineJoin()
Pen
s line join style.BasicStroke
public float getMiterLimit()
Pen
s miter limit style.BasicStroke
public float[] getDashArray()
Pen
s dash array.BasicStroke
public float getDashPhase()
Pen
s dash phase.BasicStroke
public void setLineWidth(float width)
Pen
s line width.public void setEndCap(int endCap)
Pen
s end cap style.BasicStroke
public void setLineJoin(int join)
Pen
s line join style.BasicStroke
public void setMiterLimit(float miterlimit)
Pen
s miter limit.BasicStroke
public void setDash(float[] dashArray)
Pen
s dash array.BasicStroke
public void setDashPhase(float dashPhase)
Pen
s dash phase.BasicStroke
public static java.lang.String[] getAvailableFontFamilies()
for more information about font attributes etc.
public void setFontStyle(int style)
for possible styles.
public void setFontSize(int size)
public void setFontSize(float size)
public int getFontSize()
public void setFont(java.awt.Font f)
public java.awt.Font getFont()
public static Pen.TextInfo getTextInfo(java.lang.String text, java.awt.Font font)
public int getTextWidth(java.lang.String text)
public int getTextHeight()
public int getTextAscent()
public int getTextDescent()