org.jfree.chart.annotations

Class TextAnnotation

public class TextAnnotation extends Object implements Serializable

A base class for text annotations. This class records the content but not the location of the annotation.
Field Summary
static FontDEFAULT_FONT
The default font.
static PaintDEFAULT_PAINT
The default paint.
static TextAnchorDEFAULT_ROTATION_ANCHOR
The default rotation anchor.
static doubleDEFAULT_ROTATION_ANGLE
The default rotation angle.
static TextAnchorDEFAULT_TEXT_ANCHOR
The default text anchor.
Constructor Summary
protected TextAnnotation(String text)
Creates a text annotation with default settings.
Method Summary
booleanequals(Object obj)
Tests this object for equality with an arbitrary object.
FontgetFont()
Returns the font for the annotation.
PaintgetPaint()
Returns the paint for the annotation.
TextAnchorgetRotationAnchor()
Returns the rotation anchor.
doublegetRotationAngle()
Returns the rotation angle in radians.
StringgetText()
Returns the text for the annotation.
TextAnchorgetTextAnchor()
Returns the text anchor.
inthashCode()
Returns a hash code for this instance.
voidsetFont(Font font)
Sets the font for the annotation.
voidsetPaint(Paint paint)
Sets the paint for the annotation.
voidsetRotationAnchor(TextAnchor anchor)
Sets the rotation anchor point.
voidsetRotationAngle(double angle)
Sets the rotation angle.
voidsetText(String text)
Sets the text for the annotation.
voidsetTextAnchor(TextAnchor anchor)
Sets the text anchor (the point on the text bounding rectangle that is aligned to the (x, y) coordinate of the annotation).

Field Detail

DEFAULT_FONT

public static final Font DEFAULT_FONT
The default font.

DEFAULT_PAINT

public static final Paint DEFAULT_PAINT
The default paint.

DEFAULT_ROTATION_ANCHOR

public static final TextAnchor DEFAULT_ROTATION_ANCHOR
The default rotation anchor.

DEFAULT_ROTATION_ANGLE

public static final double DEFAULT_ROTATION_ANGLE
The default rotation angle.

DEFAULT_TEXT_ANCHOR

public static final TextAnchor DEFAULT_TEXT_ANCHOR
The default text anchor.

Constructor Detail

TextAnnotation

protected TextAnnotation(String text)
Creates a text annotation with default settings.

Parameters: text the text (null not permitted).

Method Detail

equals

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

Parameters: obj the object (null permitted).

Returns: true or false.

getFont

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

Returns: The font (never null).

See Also: setFont

getPaint

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

Returns: The paint (never null).

See Also: setPaint

getRotationAnchor

public TextAnchor getRotationAnchor()
Returns the rotation anchor.

Returns: The rotation anchor point (never null).

See Also: setRotationAnchor

getRotationAngle

public double getRotationAngle()
Returns the rotation angle in radians.

Returns: The rotation angle.

See Also: TextAnnotation

getText

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

Returns: The text (never null).

See Also: setText

getTextAnchor

public TextAnchor getTextAnchor()
Returns the text anchor.

Returns: The text anchor.

See Also: setTextAnchor

hashCode

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

Returns: A hash code.

setFont

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

Parameters: font the font (null not permitted).

See Also: getFont

setPaint

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

Parameters: paint the paint (null not permitted).

See Also: getPaint

setRotationAnchor

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

Parameters: anchor the anchor (null not permitted).

See Also: getRotationAnchor

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

setText

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

Parameters: text the text (null not permitted).

See Also: getText

setTextAnchor

public void setTextAnchor(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