org.jfree.chart.annotations
Class XYTextAnnotation

java.lang.Object
  extended byorg.jfree.chart.annotations.TextAnnotation
      extended byorg.jfree.chart.annotations.XYTextAnnotation
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, XYAnnotation
Direct Known Subclasses:
XYPointerAnnotation

public class XYTextAnnotation
extends TextAnnotation
implements XYAnnotation, java.lang.Cloneable, java.io.Serializable

A text annotation that can be placed at a particular (x, y) location on an XYPlot.

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jfree.chart.annotations.TextAnnotation
DEFAULT_FONT, DEFAULT_PAINT, DEFAULT_ROTATION_ANCHOR, DEFAULT_ROTATION_ANGLE, DEFAULT_TEXT_ANCHOR
 
Constructor Summary
XYTextAnnotation(java.lang.String text, double x, double y)
          Creates a new annotation to be displayed at the given coordinates.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of the annotation.
 void draw(java.awt.Graphics2D g2, XYPlot plot, java.awt.geom.Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis)
          Draws the annotation.
 double getX()
          Returns the x coordinate for the text anchor point (measured against the domain axis).
 double getY()
          Returns the y coordinate for the text anchor point (measured against the range axis).
 void setX(double x)
          Sets the x coordinate for the text anchor point (measured against the domain axis).
 void setY(double y)
          Sets the y coordinate for the text anchor point (measured against the range axis).
 
Methods inherited from class org.jfree.chart.annotations.TextAnnotation
equals, getFont, getPaint, getRotationAnchor, getRotationAngle, getText, getTextAnchor, setFont, setPaint, setRotationAnchor, setRotationAngle, setText, setTextAnchor
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XYTextAnnotation

public XYTextAnnotation(java.lang.String text,
                        double x,
                        double y)
Creates a new annotation to be displayed at the given coordinates.

Parameters:
text - the text.
x - the x-coordinate.
y - the y-coordinate.
Method Detail

getX

public double getX()
Returns the x coordinate for the text anchor point (measured against the domain axis).

Returns:
The x coordinate.

setX

public void setX(double x)
Sets the x coordinate for the text anchor point (measured against the domain axis).

Parameters:
x - the x coordinate.

getY

public double getY()
Returns the y coordinate for the text anchor point (measured against the range axis).

Returns:
The y coordinate.

setY

public void setY(double y)
Sets the y coordinate for the text anchor point (measured against the range axis).

Parameters:
y - the y coordinate.

draw

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

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

clone

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

Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if the annotation can't be cloned.