Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jfree.chart.annotations
Class XYTextAnnotation  view XYTextAnnotation download XYTextAnnotation.java

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

public class XYTextAnnotation
extends AbstractXYAnnotation
implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable

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


Field Summary
static java.awt.Font DEFAULT_FONT
          The default font.
static java.awt.Paint DEFAULT_PAINT
          The default paint.
static org.jfree.ui.TextAnchor DEFAULT_ROTATION_ANCHOR
          The default rotation anchor.
static double DEFAULT_ROTATION_ANGLE
          The default rotation angle.
static org.jfree.ui.TextAnchor DEFAULT_TEXT_ANCHOR
          The default text anchor.
private  java.awt.Font font
          The font.
private  java.awt.Paint paint
          The paint.
private  org.jfree.ui.TextAnchor rotationAnchor
          The rotation anchor.
private  double rotationAngle
          The rotation angle.
private static long serialVersionUID
          For serialization.
private  java.lang.String text
          The text.
private  org.jfree.ui.TextAnchor textAnchor
          The text anchor (to be aligned with (x, y)).
private  double x
          The x-coordinate.
private  double y
          The y-coordinate.
 
Fields inherited from class org.jfree.chart.annotations.AbstractXYAnnotation
 
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, org.jfree.chart.plot.XYPlot plot, java.awt.geom.Rectangle2D dataArea, org.jfree.chart.axis.ValueAxis domainAxis, org.jfree.chart.axis.ValueAxis rangeAxis, int rendererIndex, org.jfree.chart.plot.PlotRenderingInfo info)
          Draws the annotation.
 boolean equals(java.lang.Object obj)
          Tests this annotation for equality with an arbitrary object.
 java.awt.Font getFont()
          Returns the font for the annotation.
 java.awt.Paint getPaint()
          Returns the paint for the annotation.
 org.jfree.ui.TextAnchor getRotationAnchor()
          Returns the rotation anchor.
 double getRotationAngle()
          Returns the rotation angle.
 java.lang.String getText()
          Returns the text for the annotation.
 org.jfree.ui.TextAnchor getTextAnchor()
          Returns the text anchor.
 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).
 int hashCode()
          Returns a hash code for the object.
private  void readObject(java.io.ObjectInputStream stream)
          Provides serialization support.
 void setFont(java.awt.Font font)
          Sets the font for the annotation.
 void setPaint(java.awt.Paint paint)
          Sets the paint for the annotation.
 void setRotationAnchor(org.jfree.ui.TextAnchor anchor)
          Sets the rotation anchor point.
 void setRotationAngle(double angle)
          Sets the rotation angle.
 void setText(java.lang.String text)
          Sets the text for the annotation.
 void setTextAnchor(org.jfree.ui.TextAnchor anchor)
          Sets the text anchor (the point on the text bounding rectangle that is aligned to the (x, y) coordinate of the annotation).
 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).
private  void writeObject(java.io.ObjectOutputStream stream)
          Provides serialization support.
 
Methods inherited from class org.jfree.chart.annotations.AbstractXYAnnotation
addEntity, getToolTipText, getURL, setToolTipText, setURL
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
For serialization.

See Also:
Constant Field Values

DEFAULT_FONT

public static final java.awt.Font DEFAULT_FONT
The default font.


DEFAULT_PAINT

public static final java.awt.Paint DEFAULT_PAINT
The default paint.


DEFAULT_TEXT_ANCHOR

public static final org.jfree.ui.TextAnchor DEFAULT_TEXT_ANCHOR
The default text anchor.


DEFAULT_ROTATION_ANCHOR

public static final org.jfree.ui.TextAnchor DEFAULT_ROTATION_ANCHOR
The default rotation anchor.


DEFAULT_ROTATION_ANGLE

public static final double DEFAULT_ROTATION_ANGLE
The default rotation angle.

See Also:
Constant Field Values

text

private java.lang.String text
The text.


font

private java.awt.Font font
The font.


paint

private transient java.awt.Paint paint
The paint.


x

private double x
The x-coordinate.


y

private double y
The y-coordinate.


textAnchor

private org.jfree.ui.TextAnchor textAnchor
The text anchor (to be aligned with (x, y)).


rotationAnchor

private org.jfree.ui.TextAnchor rotationAnchor
The rotation anchor.


rotationAngle

private double rotationAngle
The rotation angle.

Constructor Detail

XYTextAnnotation

public XYTextAnnotation(java.lang.String text,
                        double x,
                        double y)
Creates a new annotation to be displayed at the given coordinates. The coordinates are specified in data space (they will be converted to Java2D space for display).

Method Detail

getText

public java.lang.String getText()
Returns the text for the annotation.


setText

public void setText(java.lang.String text)
Sets the text for the annotation.


getFont

public java.awt.Font getFont()
Returns the font for the annotation.


setFont

public void setFont(java.awt.Font font)
Sets the font for the annotation.


getPaint

public java.awt.Paint getPaint()
Returns the paint for the annotation.


setPaint

public void setPaint(java.awt.Paint paint)
Sets the paint for the annotation.


getTextAnchor

public org.jfree.ui.TextAnchor getTextAnchor()
Returns the text anchor.


setTextAnchor

public void setTextAnchor(org.jfree.ui.TextAnchor anchor)
Sets the text anchor (the point on the text bounding rectangle that is aligned to the (x, y) coordinate of the annotation).


getRotationAnchor

public org.jfree.ui.TextAnchor getRotationAnchor()
Returns the rotation anchor.


setRotationAnchor

public void setRotationAnchor(org.jfree.ui.TextAnchor anchor)
Sets the rotation anchor point.


getRotationAngle

public double getRotationAngle()
Returns the rotation angle.


setRotationAngle

public void setRotationAngle(double angle)
Sets the rotation angle.

The angle is measured clockwise in radians.


getX

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


setX

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


getY

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


setY

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


draw

public void draw(java.awt.Graphics2D g2,
                 org.jfree.chart.plot.XYPlot plot,
                 java.awt.geom.Rectangle2D dataArea,
                 org.jfree.chart.axis.ValueAxis domainAxis,
                 org.jfree.chart.axis.ValueAxis rangeAxis,
                 int rendererIndex,
                 org.jfree.chart.plot.PlotRenderingInfo info)
Draws the annotation.

Specified by:
draw in interface XYAnnotation
Specified by:
draw in class AbstractXYAnnotation

equals

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

Overrides:
equals in class AbstractXYAnnotation

hashCode

public int hashCode()
Returns a hash code for the object.


clone

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

Specified by:
clone in interface org.jfree.util.PublicCloneable

writeObject

private void writeObject(java.io.ObjectOutputStream stream)
                  throws java.io.IOException
Provides serialization support.


readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Provides serialization support.