Package org.jfree.chart.annotations
Class TextAnnotation
java.lang.Object
org.jfree.chart.annotations.AbstractAnnotation
org.jfree.chart.annotations.TextAnnotation
- All Implemented Interfaces:
Serializable,Cloneable,Annotation
- Direct Known Subclasses:
CategoryTextAnnotation
public class TextAnnotation extends AbstractAnnotation implements Serializable
A base class for text annotations. This class records the content but not
the location of the annotation.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static FontDEFAULT_FONTThe default font.static PaintDEFAULT_PAINTThe default paint.static TextAnchorDEFAULT_ROTATION_ANCHORThe default rotation anchor.static doubleDEFAULT_ROTATION_ANGLEThe default rotation angle.static TextAnchorDEFAULT_TEXT_ANCHORThe default text anchor. -
Constructor Summary
Constructors Modifier Constructor Description protectedTextAnnotation(String text)Creates a text annotation with default settings. -
Method Summary
Modifier and Type Method Description 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 and sends anAnnotationChangeEventto all registered listeners.voidsetPaint(Paint paint)Sets the paint for the annotation and sends anAnnotationChangeEventto all registered listeners.voidsetRotationAnchor(TextAnchor anchor)Sets the rotation anchor point and sends anAnnotationChangeEventto all registered listeners.voidsetRotationAngle(double angle)Sets the rotation angle and sends anAnnotationChangeEventto all registered listeners.voidsetText(String text)Sets the text for the annotation and sends anAnnotationChangeEventto all registered listeners.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) and sends anAnnotationChangeEventto all registered listeners.Methods inherited from class org.jfree.chart.annotations.AbstractAnnotation
addChangeListener, clone, fireAnnotationChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotify
-
Field Details
-
DEFAULT_FONT
The default font. -
DEFAULT_PAINT
The default paint. -
DEFAULT_TEXT_ANCHOR
The default text anchor. -
DEFAULT_ROTATION_ANCHOR
The default rotation anchor. -
DEFAULT_ROTATION_ANGLE
The default rotation angle.- See Also:
- Constant Field Values
-
-
Constructor Details
-
TextAnnotation
Creates a text annotation with default settings.- Parameters:
text- the text (nullnot permitted).
-
-
Method Details
-
getText
Returns the text for the annotation.- Returns:
- The text (never
null). - See Also:
setText(String)
-
setText
Sets the text for the annotation and sends anAnnotationChangeEventto all registered listeners.- Parameters:
text- the text (nullnot permitted).- See Also:
getText()
-
getFont
Returns the font for the annotation.- Returns:
- The font (never
null). - See Also:
setFont(Font)
-
setFont
Sets the font for the annotation and sends anAnnotationChangeEventto all registered listeners.- Parameters:
font- the font (nullnot permitted).- See Also:
getFont()
-
getPaint
Returns the paint for the annotation.- Returns:
- The paint (never
null). - See Also:
setPaint(Paint)
-
setPaint
Sets the paint for the annotation and sends anAnnotationChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getPaint()
-
getTextAnchor
Returns the text anchor.- Returns:
- The text anchor.
- See Also:
setTextAnchor(TextAnchor)
-
setTextAnchor
Sets the text anchor (the point on the text bounding rectangle that is aligned to the (x, y) coordinate of the annotation) and sends anAnnotationChangeEventto all registered listeners.- Parameters:
anchor- the anchor point (nullnot permitted).- See Also:
getTextAnchor()
-
getRotationAnchor
Returns the rotation anchor.- Returns:
- The rotation anchor point (never
null). - See Also:
setRotationAnchor(TextAnchor)
-
setRotationAnchor
Sets the rotation anchor point and sends anAnnotationChangeEventto all registered listeners.- Parameters:
anchor- the anchor (nullnot permitted).- See Also:
getRotationAnchor()
-
getRotationAngle
Returns the rotation angle in radians.- Returns:
- The rotation angle.
- See Also:
setRotationAngle(double)
-
setRotationAngle
Sets the rotation angle and sends anAnnotationChangeEventto all registered listeners. The angle is measured clockwise in radians.- Parameters:
angle- the angle (in radians).- See Also:
getRotationAngle()
-
equals
Tests this object for equality with an arbitrary object. -
hashCode
Returns a hash code for this instance.
-