org.jfree.chart.annotations
Class CategoryLineAnnotation

java.lang.Object
  extended by org.jfree.chart.annotations.CategoryLineAnnotation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CategoryAnnotation

public class CategoryLineAnnotation
extends java.lang.Object
implements CategoryAnnotation, java.lang.Cloneable, java.io.Serializable

A line annotation that can be placed on a CategoryPlot.

See Also:
Serialized Form

Constructor Summary
CategoryLineAnnotation(java.lang.Comparable category1, double value1, java.lang.Comparable category2, double value2, java.awt.Paint paint, java.awt.Stroke stroke)
          Creates a new annotation that draws a line between (category1, value1) and (category2, value2).
 
Method Summary
 java.lang.Object clone()
          Returns a clone of the annotation.
 void draw(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)
          Draws the annotation.
 boolean equals(java.lang.Object obj)
          Tests this object for equality with another.
 java.lang.Comparable getCategory1()
          Returns the category for the start of the line.
 java.lang.Comparable getCategory2()
          Returns the category for the end of the line.
 java.awt.Paint getPaint()
          Returns the paint used to draw the connecting line.
 java.awt.Stroke getStroke()
          Returns the stroke used to draw the connecting line.
 double getValue1()
          Returns the y-value for the start of the line.
 double getValue2()
          Returns the y-value for the end of the line.
 int hashCode()
          Returns a hash code for this instance.
 void setCategory1(java.lang.Comparable category)
          Sets the category for the start of the line.
 void setCategory2(java.lang.Comparable category)
          Sets the category for the end of the line.
 void setPaint(java.awt.Paint paint)
          Sets the paint used to draw the connecting line.
 void setStroke(java.awt.Stroke stroke)
          Sets the stroke used to draw the connecting line.
 void setValue1(double value)
          Sets the y-value for the start of the line.
 void setValue2(double value)
          Sets the y-value for the end of the line.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CategoryLineAnnotation

public CategoryLineAnnotation(java.lang.Comparable category1,
                              double value1,
                              java.lang.Comparable category2,
                              double value2,
                              java.awt.Paint paint,
                              java.awt.Stroke stroke)
Creates a new annotation that draws a line between (category1, value1) and (category2, value2).

Parameters:
category1 - the category (null not permitted).
value1 - the value.
category2 - the category (null not permitted).
value2 - the value.
paint - the line color (null not permitted).
stroke - the line stroke (null not permitted).
Method Detail

getCategory1

public java.lang.Comparable getCategory1()
Returns the category for the start of the line.

Returns:
The category for the start of the line (never null).

setCategory1

public void setCategory1(java.lang.Comparable category)
Sets the category for the start of the line.

Parameters:
category - the category (null not permitted).

getValue1

public double getValue1()
Returns the y-value for the start of the line.

Returns:
The y-value for the start of the line.

setValue1

public void setValue1(double value)
Sets the y-value for the start of the line.

Parameters:
value - the value.

getCategory2

public java.lang.Comparable getCategory2()
Returns the category for the end of the line.

Returns:
The category for the end of the line (never null).

setCategory2

public void setCategory2(java.lang.Comparable category)
Sets the category for the end of the line.

Parameters:
category - the category (null not permitted).

getValue2

public double getValue2()
Returns the y-value for the end of the line.

Returns:
The y-value for the end of the line.

setValue2

public void setValue2(double value)
Sets the y-value for the end of the line.

Parameters:
value - the value.

getPaint

public java.awt.Paint getPaint()
Returns the paint used to draw the connecting line.

Returns:
The paint (never null).

setPaint

public void setPaint(java.awt.Paint paint)
Sets the paint used to draw the connecting line.

Parameters:
paint - the paint (null not permitted).

getStroke

public java.awt.Stroke getStroke()
Returns the stroke used to draw the connecting line.

Returns:
The stroke (never null).

setStroke

public void setStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the connecting line.

Parameters:
stroke - the stroke (null not permitted).

draw

public void draw(java.awt.Graphics2D g2,
                 CategoryPlot plot,
                 java.awt.geom.Rectangle2D dataArea,
                 CategoryAxis domainAxis,
                 ValueAxis rangeAxis)
Draws the annotation.

Specified by:
draw in interface CategoryAnnotation
Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the data area.
domainAxis - the domain axis.
rangeAxis - the range axis.

equals

public boolean equals(java.lang.Object obj)
Tests this object for equality with another.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object (null permitted).
Returns:
true or false.

hashCode

public int hashCode()
Returns a hash code for this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the annotation.

Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - this class will not throw this exception, but subclasses (if any) might.