ch.aplu.turtle
Class Pen

java.lang.Object
  extended by ch.aplu.turtle.Pen

public class Pen
extends java.lang.Object

The Pen class provides anything used for drawing the lines, such as line width, pen color, end caps, dashed lines, etc.

See Also:
BasicStroke

Field Summary
static java.awt.Font DEFAULT_FONT
          The default font that is used when drawing Text.
 
Constructor Summary
Pen()
          Constructor with standard Color and standard Stroke.
Pen(java.awt.Color color)
          Constructor with Color color and standard Stroke.
 
Method Summary
static java.lang.String[] getAvailableFontFamilies()
          Provides information about the currently available font families (e.g.
 java.awt.Color getColor()
          Query the Pens color.
 float[] getDashArray()
          Query the Pens dash array.
 float getDashPhase()
          Query the Pens dash phase.
 int getEndCap()
          Query the Pens end cap style.
 java.awt.Color getFillColor()
          Query the Pens fill color.
 java.awt.Font getFont()
          Query the current font.
 int getFontSize()
          Query the size (in points, rounded to int) of the current font.
 int getLineJoin()
          Query the Pens line join style.
 float getLineWidth()
          Query the Pens line width
 float getMiterLimit()
          Query the Pens miter limit style.
 java.awt.Stroke getStroke()
          Get the Pens Stroke
 void setColor(java.awt.Color color)
          Set the Pens color.
 void setDash(float[] dashArray)
          Set the Pens dash array.
 void setDashPhase(float dashPhase)
          Set the Pens dash phase.
 void setEndCap(int endCap)
          Set the Pens end cap style.
 void setFillColor(java.awt.Color color)
          Set the Pens fill color.
 void setFont(java.awt.Font f)
          Change the font to the given one.
 void setFontSize(float size)
          Change the font size (in points).
 void setFontSize(int size)
          Change the font size (in points).
 void setFontStyle(int style)
          Change the font style.
 void setLineJoin(int join)
          Set the Pens line join style.
 void setLineWidth(float width)
          Set the Pens line width.
 void setMiterLimit(float miterlimit)
          Set the Pens miter limit.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FONT

public static java.awt.Font DEFAULT_FONT
The default font that is used when drawing Text. First argument must be one of "Serif", "SansSerif", "Monotyped", "Dialog" or "DialogInput" to guarantee that this font exists on all systems.

See Also:
for more information, e.g. on font styles.
Constructor Detail

Pen

public Pen()
Constructor with standard Color and standard Stroke.

See Also:
BasicStroke

Pen

public Pen(java.awt.Color color)
Constructor with Color color and standard Stroke.

See Also:
BasicStroke
Method Detail

getColor

public java.awt.Color getColor()
Query the Pens color.


setColor

public void setColor(java.awt.Color color)
Set the Pens color.


setFillColor

public void setFillColor(java.awt.Color color)
Set the Pens fill color.


getFillColor

public java.awt.Color getFillColor()
Query the Pens fill color.


getStroke

public java.awt.Stroke getStroke()
Get the Pens Stroke

See Also:
BasicStroke, Stroke

getLineWidth

public float getLineWidth()
Query the Pens line width


getEndCap

public int getEndCap()
Query the Pens end cap style.

See Also:
BasicStroke

getLineJoin

public int getLineJoin()
Query the Pens line join style.

See Also:
BasicStroke

getMiterLimit

public float getMiterLimit()
Query the Pens miter limit style.

See Also:
BasicStroke

getDashArray

public float[] getDashArray()
Query the Pens dash array.

See Also:
BasicStroke

getDashPhase

public float getDashPhase()
Query the Pens dash phase.

See Also:
BasicStroke

setLineWidth

public void setLineWidth(float width)
Set the Pens line width.


setEndCap

public void setEndCap(int endCap)
Set the Pens end cap style.

See Also:
BasicStroke

setLineJoin

public void setLineJoin(int join)
Set the Pens line join style.

See Also:
BasicStroke

setMiterLimit

public void setMiterLimit(float miterlimit)
Set the Pens miter limit.

See Also:
BasicStroke

setDash

public void setDash(float[] dashArray)
Set the Pens dash array.

See Also:
BasicStroke

setDashPhase

public void setDashPhase(float dashPhase)
Set the Pens dash phase.

See Also:
BasicStroke

getAvailableFontFamilies

public static java.lang.String[] getAvailableFontFamilies()
Provides information about the currently available font families (e.g. "Roman"). Each font name is a string packed into a array of strings.

See Also:
for more information about font attributes etc.

setFontStyle

public void setFontStyle(int style)
Change the font style.

See Also:
for possible styles.

setFontSize

public void setFontSize(int size)
Change the font size (in points).


setFontSize

public void setFontSize(float size)
Change the font size (in points). You will probably only need the int version setFontSize(int).


getFontSize

public int getFontSize()
Query the size (in points, rounded to int) of the current font.


setFont

public void setFont(java.awt.Font f)
Change the font to the given one.


getFont

public java.awt.Font getFont()
Query the current font.