Header
And More


org.jfree.chart.annotations
Class XYTextAnnotation

java.lang.Object
  extended by org.jfree.chart.annotations.AbstractXYAnnotation
      extended by org.jfree.chart.annotations.XYTextAnnotation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, XYAnnotation, org.jfree.util.PublicCloneable
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 XYPlot.

See Also:
Serialized Form

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.
 
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, int rendererIndex, PlotRenderingInfo info)
          Draws the annotation.
 boolean equals(java.lang.Object obj)
          Tests this annotation for equality with an arbitrary object.
 java.awt.Paint getBackgroundPaint()
          Returns the background paint for the annotation.
 java.awt.Font getFont()
          Returns the font for the annotation.
 java.awt.Paint getOutlinePaint()
          Returns the outline paint for the annotation.
 java.awt.Stroke getOutlineStroke()
          Returns the outline stroke 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.
 boolean isOutlineVisible()
          Returns the flag that controls whether or not the outline is drawn.
 void setBackgroundPaint(java.awt.Paint paint)
          Sets the background paint for the annotation.
 void setFont(java.awt.Font font)
          Sets the font for the annotation.
 void setOutlinePaint(java.awt.Paint paint)
          Sets the outline paint for the annotation.
 void setOutlineStroke(java.awt.Stroke stroke)
          Sets the outline stroke for the annotation.
 void setOutlineVisible(boolean visible)
          Sets the flag that controls whether or not the outline is drawn.
 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).
 
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

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
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).

Parameters:
text - the text (null not permitted).
x - the x-coordinate (in data space).
y - the y-coordinate (in data space).
Method Detail

getText

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

Returns:
The text (never null).
See Also:
setText(String)

setText

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

Parameters:
text - the text (null not permitted).
See Also:
getText()

getFont

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

Returns:
The font (never null).
See Also:
setFont(Font)

setFont

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

Parameters:
font - the font (null not permitted).
See Also:
getFont()

getPaint

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

Returns:
The paint (never null).
See Also:
setPaint(Paint)

setPaint

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

Parameters:
paint - the paint (null not permitted).
See Also:
getPaint()

getTextAnchor

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

Returns:
The text anchor (never null).
See Also:
setTextAnchor(TextAnchor)

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).

Parameters:
anchor - the anchor point (null not permitted).
See Also:
getTextAnchor()

getRotationAnchor

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

Returns:
The rotation anchor point (never null).
See Also:
setRotationAnchor(TextAnchor)

setRotationAnchor

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

Parameters:
anchor - the anchor (null not permitted).
See Also:
getRotationAnchor()

getRotationAngle

public double getRotationAngle()
Returns the rotation angle.

Returns:
The rotation angle.
See Also:
setRotationAngle(double)

setRotationAngle

public void setRotationAngle(double angle)
Sets the rotation angle. The angle is measured clockwise in radians.

Parameters:
angle - the angle (in radians).
See Also:
getRotationAngle()

getX

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

Returns:
The x coordinate (in data space).
See Also:
setX(double)

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 (in data space).
See Also:
getX()

getY

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

Returns:
The y coordinate (in data space).
See Also:
setY(double)

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.
See Also:
getY()

getBackgroundPaint

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

Returns:
The background paint (possibly null).
Since:
1.0.13
See Also:
setBackgroundPaint(Paint)

setBackgroundPaint

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

Parameters:
paint - the paint (null permitted).
Since:
1.0.13
See Also:
getBackgroundPaint()

getOutlinePaint

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

Returns:
The outline paint (never null).
Since:
1.0.13
See Also:
setOutlinePaint(Paint)

setOutlinePaint

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

Parameters:
paint - the paint (null not permitted).
Since:
1.0.13
See Also:
getOutlinePaint()

getOutlineStroke

public java.awt.Stroke getOutlineStroke()
Returns the outline stroke for the annotation.

Returns:
The outline stroke (never null).
Since:
1.0.13
See Also:
setOutlineStroke(Stroke)

setOutlineStroke

public void setOutlineStroke(java.awt.Stroke stroke)
Sets the outline stroke for the annotation.

Parameters:
stroke - the stroke (null not permitted).
Since:
1.0.13
See Also:
getOutlineStroke()

isOutlineVisible

public boolean isOutlineVisible()
Returns the flag that controls whether or not the outline is drawn.

Returns:
A boolean.
Since:
1.0.13

setOutlineVisible

public void setOutlineVisible(boolean visible)
Sets the flag that controls whether or not the outline is drawn.

Parameters:
visible - the new flag value.
Since:
1.0.13

draw

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

Specified by:
draw in interface XYAnnotation
Specified by:
draw in class AbstractXYAnnotation
Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the data area.
domainAxis - the domain axis.
rangeAxis - the range axis.
rendererIndex - the renderer index.
info - an optional info object that will be populated with entity information.

equals

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

Overrides:
equals in class AbstractXYAnnotation
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

hashCode

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

Overrides:
hashCode in class AbstractXYAnnotation
Returns:
A hash code.

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
Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if the annotation can't be cloned.

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.