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
FieldsModifier and TypeFieldDescriptionstatic final FontThe default font.static final PaintThe default paint.static final TextAnchorThe default rotation anchor.static final doubleThe default rotation angle.static final TextAnchorThe default text anchor.private FontThe font.private PaintThe paint.private TextAnchorThe rotation anchor.private doubleThe rotation angle.private static final longFor serialization.private StringThe text.private TextAnchorThe text anchor. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTextAnnotation(String text) Creates a text annotation with default settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanEnsures symmetry between super/subclass implementations of equals.booleanTests 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.doubleReturns the rotation angle in radians.getText()Returns the text for the annotation.Returns the text anchor.inthashCode()Returns a hash code for this instance.private voidreadObject(ObjectInputStream stream) Provides serialization support.voidSets the font for the annotation and sends anAnnotationChangeEventto all registered listeners.voidSets 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.voidSets 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.private voidwriteObject(ObjectOutputStream stream) Provides serialization support.Methods inherited from class org.jfree.chart.annotations.AbstractAnnotation
addChangeListener, clone, fireAnnotationChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotify
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
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
public static final double DEFAULT_ROTATION_ANGLEThe default rotation angle.- See Also:
-
text
The text. -
font
The font. -
paint
The paint. -
textAnchor
The text anchor. -
rotationAnchor
The rotation anchor. -
rotationAngle
private double rotationAngleThe rotation angle.
-
-
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
Sets the text for the annotation and sends anAnnotationChangeEventto all registered listeners.- Parameters:
text- the text (nullnot 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 anAnnotationChangeEventto all registered listeners.- Parameters:
font- the font (nullnot 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 anAnnotationChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot 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 anAnnotationChangeEventto all registered listeners.- Parameters:
anchor- the anchor point (nullnot 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 anAnnotationChangeEventto all registered listeners.- Parameters:
anchor- the anchor (nullnot permitted).- See Also:
-
getRotationAngle
public double getRotationAngle()Returns the rotation angle in radians.- Returns:
- The rotation angle.
- See Also:
-
setRotationAngle
public void setRotationAngle(double angle) 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:
-
equals
Tests this object for equality with an arbitrary object.- Overrides:
equalsin classAbstractAnnotation- Parameters:
obj- the object (nullpermitted).- Returns:
trueorfalse.
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqualin classAbstractAnnotation- Parameters:
other- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
public int hashCode()Returns a hash code for this instance.- Overrides:
hashCodein classAbstractAnnotation- Returns:
- A hash code.
-
writeObject
Provides serialization support.- Parameters:
stream- the output stream.- Throws:
IOException- if there is an I/O error.
-
readObject
Provides serialization support.- Parameters:
stream- the input stream.- Throws:
IOException- if there is an I/O error.ClassNotFoundException- if there is a classpath problem.
-