ChartCat 1.2

li.netcat.chart.util
Class Pen

java.lang.Object
  extended byli.netcat.chart.util.Pen

public class Pen
extends java.lang.Object

Immutable class representing a pen. Its properties are used to paint a shape, i.e. fill it with a paint and stroke its outline. The pen has the following properties:

The general concept denotes that an instance of a pen cannot be modified.

Author:
Arthur Marxer

Constructor Summary
Pen(java.awt.Paint fillPaint)
          Constructs a new pen using the given paint to fill shapes.
Pen(java.awt.Stroke stroke, java.awt.Paint outlinePaint)
          Constructs a new pen using the given stroke and the given paint that is used to draw and fill shapes.
Pen(java.awt.Stroke stroke, java.awt.Paint outlinePaint, java.awt.Paint fillPaint)
          Constructs a new pen using the given stroke and the given paints.
 
Method Summary
static Pen[] createFillPens(int fillFrom, int fillTo)
          Utility method that creates a series of pens with no stroke and no outline paint.
static Pen[] createPens(int outlineFrom, int outlineTo, int fillFrom, int fillTo)
          Utility method that creates a series of pens with different draw and fill colors.
static Pen[] createPens(java.awt.Stroke stroke, int outlineFrom, int outlineTo, int fillFrom, int fillTo)
          Utility method that creates a series of pens with different draw and fill colors.
 Pen fillPaint(java.awt.Paint fillPaint)
          Constructs a new pen object by using all properties of this instance and replacing its fill paint by the given paint.
static Pen getDefaultCapButt()
          Returns the default pen with butt caps.
static Pen getDefaultCapRound()
          Returns the default pen with round caps.
static Pen getDefaultCapSquare()
          Returns the default pen with square caps.
static Pen getDefaultDashed()
          Returns the default dashed pen.
 java.awt.Paint getFillPaint()
          Returns the paint of this pen that is used to fill a shape.
 java.awt.Paint getOutlinePaint()
          Returns the paint of this pen that is used to draw the outline of a shape.
 java.awt.Stroke getStroke()
          Returns the stroke of this pen.
 Pen outlinePaint(java.awt.Paint outlinePaint)
          Constructs a new pen object by using all properties of this instance and replacing its outline paint by the given paint.
static void setDefaultCapButt(Pen pen)
          Sets the default pen with butt caps.
static void setDefaultCapRound(Pen pen)
          Sets the default pen with round caps.
static void setDefaultCapSquare(Pen pen)
          Sets the default pen with square caps.
static void setDefaultDashed(Pen pen)
          Sets the default dashed pen.
 Pen stroke(java.awt.Stroke stroke)
          Constructs a new pen by using all properties of this instance and replacing its stroke by the given stroke.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pen

public Pen(java.awt.Stroke stroke,
           java.awt.Paint outlinePaint)
Constructs a new pen using the given stroke and the given paint that is used to draw and fill shapes.

Parameters:
stroke - The stroke of the pen, can be null.
outlinePaint - The paint of the pen that is used to draw the outline of a shape, can be null.

Pen

public Pen(java.awt.Paint fillPaint)
Constructs a new pen using the given paint to fill shapes. The stroke and the outline paint are set to null.

Parameters:
fillPaint - The paint of the pen that is used to fill a shape, can be null.

Pen

public Pen(java.awt.Stroke stroke,
           java.awt.Paint outlinePaint,
           java.awt.Paint fillPaint)
Constructs a new pen using the given stroke and the given paints.

Parameters:
stroke - The stroke of the pen, can be null.
outlinePaint - The paint of the pen that is used to draw the outline of a shape, can be null.
fillPaint - The paint of the pen that is used to fill a shape, can be null.
Method Detail

createFillPens

public static Pen[] createFillPens(int fillFrom,
                                   int fillTo)
Utility method that creates a series of pens with no stroke and no outline paint. The creation of the fill colors can be influenced by the given parameters.

Parameters:
fillFrom - The lower color component for the fill colors. 0 <= fillFrom < 256.
fillTo - The upper color component for the fill colors. 0 <= fillTo < 256.

createPens

public static Pen[] createPens(int outlineFrom,
                               int outlineTo,
                               int fillFrom,
                               int fillTo)
Utility method that creates a series of pens with different draw and fill colors. The creation of the colors can be influenced by the given parameters.

Parameters:
outlineFrom - The lower color component for the outline colors. 0 <= outlineFrom < 256.
outlineTo - The upper color component for the outline colors. 0 <= outlineTo < 256.
fillFrom - The lower color component for the fill colors. 0 <= fillFrom < 256.
fillTo - The upper color component for the fill colors. 0 <= fillTo < 256.

createPens

public static Pen[] createPens(java.awt.Stroke stroke,
                               int outlineFrom,
                               int outlineTo,
                               int fillFrom,
                               int fillTo)
Utility method that creates a series of pens with different draw and fill colors. The creation of the colors can be influenced by the given parameters.

Parameters:
stroke - The stroke used for all pens.
outlineFrom - The lower color component for the outline colors. 0 <= outlineFrom < 256.
outlineTo - The upper color component for the outline colors. 0 <= outlineTo < 256.
fillFrom - The lower color component for the fill colors. 0 <= fillFrom < 256.
fillTo - The upper color component for the fill colors. 0 <= fillTo < 256.

getDefaultCapRound

public static Pen getDefaultCapRound()
Returns the default pen with round caps.

Returns:
The default pen with round caps, never null.

setDefaultCapRound

public static void setDefaultCapRound(Pen pen)
Sets the default pen with round caps.

Parameters:
pen - The new default pen with round caps, not null.

getDefaultCapButt

public static Pen getDefaultCapButt()
Returns the default pen with butt caps.

Returns:
The default pen with butt caps, never null.

setDefaultCapButt

public static void setDefaultCapButt(Pen pen)
Sets the default pen with butt caps.

Parameters:
pen - The new default pen with butt caps, not null.

getDefaultCapSquare

public static Pen getDefaultCapSquare()
Returns the default pen with square caps.

Returns:
The default pen with square caps, never null.

setDefaultCapSquare

public static void setDefaultCapSquare(Pen pen)
Sets the default pen with square caps.

Parameters:
pen - The new default pen with square caps, not null.

getDefaultDashed

public static Pen getDefaultDashed()
Returns the default dashed pen.

Returns:
The default dashed pen, never null.

setDefaultDashed

public static void setDefaultDashed(Pen pen)
Sets the default dashed pen.

Parameters:
pen - The new default dashed pen, not null.

getStroke

public java.awt.Stroke getStroke()
Returns the stroke of this pen. It is used to draw the outline of a shape.

Returns:
The stroke of this pen, might be null.

getOutlinePaint

public java.awt.Paint getOutlinePaint()
Returns the paint of this pen that is used to draw the outline of a shape.

Returns:
The paint of this pen used to draw the outline of a shape, can also be null.

getFillPaint

public java.awt.Paint getFillPaint()
Returns the paint of this pen that is used to fill a shape.

Returns:
The paint of this pen used to fill a shape, can also be null.

stroke

public Pen stroke(java.awt.Stroke stroke)
Constructs a new pen by using all properties of this instance and replacing its stroke by the given stroke.

Parameters:
stroke - The new stroke, might also be null.
Returns:
A new pen object or this instance, if the new stroke == the current stroke.

fillPaint

public Pen fillPaint(java.awt.Paint fillPaint)
Constructs a new pen object by using all properties of this instance and replacing its fill paint by the given paint.

Parameters:
fillPaint - The new fill paint, can be null.
Returns:
A new pen object or this instance, if the new fill paint == the current fill paint.

outlinePaint

public Pen outlinePaint(java.awt.Paint outlinePaint)
Constructs a new pen object by using all properties of this instance and replacing its outline paint by the given paint.

Parameters:
outlinePaint - The new outline paint, can be null.
Returns:
A new pen object or this instance, if the new outline paint == the current outline paint.

ChartCat 1.2

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print