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
A base class for text annotations. This class records the content but not
the location of the annotation.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Font
The default font.static final Paint
The default paint.static final TextAnchor
The default rotation anchor.static final double
The default rotation angle.static final TextAnchor
The default text anchor. -
Constructor Summary
ModifierConstructorDescriptionprotected
TextAnnotation
(String text) Creates a text annotation with default settings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Ensures symmetry between super/subclass implementations of equals.boolean
Tests this object for equality with an arbitrary object.getFont()
Returns the font for the annotation.getPaint()
Returns the paint for the annotation.Returns the rotation anchor.double
Returns the rotation angle in radians.getText()
Returns the text for the annotation.Returns the text anchor.int
hashCode()
Returns a hash code for this instance.void
Sets the font for the annotation and sends anAnnotationChangeEvent
to all registered listeners.void
Sets the paint for the annotation and sends anAnnotationChangeEvent
to all registered listeners.void
setRotationAnchor
(TextAnchor anchor) Sets the rotation anchor point and sends anAnnotationChangeEvent
to all registered listeners.void
setRotationAngle
(double angle) Sets the rotation angle and sends anAnnotationChangeEvent
to all registered listeners.void
Sets the text for the annotation and sends anAnnotationChangeEvent
to all registered listeners.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) and sends anAnnotationChangeEvent
to 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:
-
-
Constructor Details
-
TextAnnotation
Creates a text annotation with default settings.- Parameters:
text
- the text (null
not permitted).
-
-
Method Details
-
getText
Returns the text for the annotation.- Returns:
- The text (never
null
). - See Also:
-
setText
Sets the text for the annotation and sends anAnnotationChangeEvent
to all registered listeners.- Parameters:
text
- the text (null
not permitted).- See Also:
-
getFont
Returns the font for the annotation.- Returns:
- The font (never
null
). - See Also:
-
setFont
Sets the font for the annotation and sends anAnnotationChangeEvent
to all registered listeners.- Parameters:
font
- the font (null
not permitted).- See Also:
-
getPaint
Returns the paint for the annotation.- Returns:
- The paint (never
null
). - See Also:
-
setPaint
Sets the paint for the annotation and sends anAnnotationChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getTextAnchor
Returns the text anchor.- Returns:
- The text anchor.
- See Also:
-
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 anAnnotationChangeEvent
to all registered listeners.- Parameters:
anchor
- the anchor point (null
not permitted).- See Also:
-
getRotationAnchor
Returns the rotation anchor.- Returns:
- The rotation anchor point (never
null
). - See Also:
-
setRotationAnchor
Sets the rotation anchor point and sends anAnnotationChangeEvent
to all registered listeners.- Parameters:
anchor
- the anchor (null
not permitted).- See Also:
-
getRotationAngle
Returns the rotation angle in radians.- Returns:
- The rotation angle.
- See Also:
-
setRotationAngle
Sets the rotation angle and sends anAnnotationChangeEvent
to all registered listeners. The angle is measured clockwise in radians.- Parameters:
angle
- the angle (in radians).- See Also:
-
equals
Tests this object for equality with an arbitrary object.- Overrides:
equals
in classAbstractAnnotation
- Parameters:
obj
- the object (null
permitted).- Returns:
true
orfalse
.
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqual
in classAbstractAnnotation
- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
Returns a hash code for this instance.- Overrides:
hashCode
in classAbstractAnnotation
- Returns:
- A hash code.
-