public class AnnotationText extends AnnotationObject
Provides access to the AnnotationText object.
The AnnotationText class allows you to add annotation text objects to your charting applications. This object is very similar to the AnnotationText class, however the balloon objects have a tip for referencing a specific point.
Below is an example of an annotation text object:
| Constructor and Description |
|---|
AnnotationText()
Constructs a newly allocated AnnotationText object
|
AnnotationText(java.lang.String text)
Constructs a newly allocated AnnotationText object
|
| Modifier and Type | Method and Description |
|---|---|
StringAlignment |
getAlign()
Allows you to set the alignment for the selected annotation text object.
|
java.awt.Font |
getFont()
Allows you to change the font attributes for an annotation object.
|
StringAlignment |
getLineAlignment()
Sets the vertical alignment for the lines of an annotation text object.
|
int |
getOrientation()
Used to set the text orientation for a annotation text object.
|
java.lang.String |
getText()
Used to set the text for an annotation text object.
|
java.awt.Color |
getTextColor()
Sets the color of the text for an annotation object.
|
boolean |
isClip()
Gets or sets a value indicating whether or not text will be clipped by the border of an AnnotationText.
|
boolean |
isWordWrap()
Gets or sets a value indicating whether the text of an annotation text object will be word wrapped.
|
void |
resetAlign()
Set the property Align to its default value.
|
void |
resetFont()
Set the property Font to its default value.
|
void |
resetLineAlignment()
Set the property LineAlignment to its default value.
|
void |
resetOrientation()
Set the property Orientation to its default value.
|
void |
resetText()
Set the property Text to its default value.
|
void |
resetTextColor()
Set the property TextColor to its default value.
|
void |
resetTextStyle()
Set the property TextStyle to its default value.
|
void |
setAlign(StringAlignment value)
Allows you to set the alignment for the selected annotation text object.
|
void |
setClip(boolean value)
Gets or sets a value indicating whether or not text will be clipped by the border of an AnnotationText.
|
void |
setFont(java.awt.Font value)
Allows you to change the font attributes for an annotation object.
|
void |
setLineAlignment(StringAlignment value)
Sets the vertical alignment for the lines of an annotation text object.
|
void |
setOrientation(int value)
Used to set the text orientation for a annotation text object.
|
void |
setText(java.lang.String value)
Used to set the text for an annotation text object.
|
void |
setTextColor(java.awt.Color value)
Sets the color of the text for an annotation object.
|
void |
setWordWrap(boolean value)
Gets or sets a value indicating whether the text of an annotation text object will be word wrapped.
|
void |
sizeToFit()
Instructs Chart FX to resize a selected annotation text object to fit the configured text string.
|
attach, attach, attach, attach, attach, attach, attach, detach, flip, getAnchor, getBorder, getColor, getHeight, getLeft, getLink, getObjectBounds, getPattern, getTag, getTop, getWidth, isAllowModify, isAllowMove, isPaintBefore, isPlotAreaOnly, isVisible, refresh, resetAllowModify, resetAllowMove, resetAnchor, resetBoundsNormalized, resetColor, resetPaintBefore, resetPattern, resetPlotAreaOnly, resetVisible, rotate, setAllowModify, setAllowMove, setAnchor, setBorder, setColor, setHeight, setLeft, setObjectBounds, setPaintBefore, setPattern, setPlotAreaOnly, setTag, setTop, setVisible, setWidthpublic AnnotationText()
public AnnotationText(java.lang.String text)
text - public StringAlignment getAlign()
Allows you to set the alignment for the selected annotation text object.
You can align the text in the text object using this method. You can adjust the alignment for the entire text line using the setLineAlignment method.
The text for the object can be set using the setText method. You can also set the color using the setTextColor method.
The text orientation may be controlled by utilizing the setOrientation method.
To set the font associated with the text object, please refer to the setFont method.
The sizeToFit method instructs Chart FX to calculate the best fit for the selected Text Object.
Set the alignment to Far for the text object:
resetAlignpublic void setAlign(StringAlignment value)
Allows you to set the alignment for the selected annotation text object.
You can align the text in the text object using this method. You can adjust the alignment for the entire text line using the setLineAlignment method.
The text for the object can be set using the setText method. You can also set the color using the setTextColor method.
The text orientation may be controlled by utilizing the setOrientation method.
To set the font associated with the text object, please refer to the setFont method.
The sizeToFit method instructs Chart FX to calculate the best fit for the selected Text Object.
Set the alignment to Far for the text object:
value - resetAlignpublic boolean isClip()
AnnotationText annText; annText = new AnnotationText(); annText.setClip(false);
public void setClip(boolean value)
AnnotationText annText; annText = new AnnotationText(); annText.setClip(false);
value - public java.awt.Font getFont()
Allows you to change the font attributes for an annotation object.
When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.
You can set the text for the text object using the setText method. You can modify the text color using the setTextColor method.
For more information regarding the Font type, please refer to the Java Documentation.
To set the font for an annotation text object:
resetFontpublic void setFont(java.awt.Font value)
Allows you to change the font attributes for an annotation object.
When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.
You can set the text for the text object using the setText method. You can modify the text color using the setTextColor method.
For more information regarding the Font type, please refer to the Java Documentation.
To set the font for an annotation text object:
value - resetFontpublic StringAlignment getLineAlignment()
Sets the vertical alignment for the lines of an annotation text object.
The horizontal text alignment may be modified using the setAlign method.
You can set the text for the text object using the setText method. You can modify the text color using the setTextColor method.
The sizeToFit method instructs Chart FX to calculate the best fit for the selected Text Object.
The text orientation may be controlled by utilizing the setOrientation method.
To set the font associated with the text object, please refer to the setFont method.
To set the LineAlignment to 'Near' for an annotation text object:
resetLineAlignmentpublic void setLineAlignment(StringAlignment value)
Sets the vertical alignment for the lines of an annotation text object.
The horizontal text alignment may be modified using the setAlign method.
You can set the text for the text object using the setText method. You can modify the text color using the setTextColor method.
The sizeToFit method instructs Chart FX to calculate the best fit for the selected Text Object.
The text orientation may be controlled by utilizing the setOrientation method.
To set the font associated with the text object, please refer to the setFont method.
To set the LineAlignment to 'Near' for an annotation text object:
value - resetLineAlignmentpublic int getOrientation()
Used to set the text orientation for a annotation text object.
When you rotate a Text Object this setting will be changed accordingly to the rotation angle selected for the Text object.
Set the text orientation for the text object to Right to Left:
Annotations annots; annots = new Annotations(); chart1.getExtensions().add(((IExtension)annots)); AnnotationText text; text = new AnnotationText(); annots.getList().add(((AnnotationObject)text)); text.setOrientation(2);
resetOrientationpublic void setOrientation(int value)
Used to set the text orientation for a annotation text object.
When you rotate a Text Object this setting will be changed accordingly to the rotation angle selected for the Text object.
Set the text orientation for the text object to Right to Left:
Annotations annots; annots = new Annotations(); chart1.getExtensions().add(((IExtension)annots)); AnnotationText text; text = new AnnotationText(); annots.getList().add(((AnnotationObject)text)); text.setOrientation(2);
value - resetOrientationpublic java.lang.String getText()
Used to set the text for an annotation text object.
The setTextColor method allows you to change the text color of the annotation text object.
The horizontal text alignment may be modified using the setAlign method. You can adjust the alignment for the entire text line using the setLineAlignment method.
The text orientation may be controlled by utilizing the setOrientation method.
To set the font associated with the text object, please refer to the setFont method.
To set the text string for an annotation text object:
Annotations annots;
annots = new Annotations();
chart1.getExtensions().add(((IExtension)annots));
AnnotationText text;
text = new AnnotationText();
annots.getList().add(((AnnotationObject)text));
text.setText("Sample Text");
resetTextpublic void setText(java.lang.String value)
Used to set the text for an annotation text object.
The setTextColor method allows you to change the text color of the annotation text object.
The horizontal text alignment may be modified using the setAlign method. You can adjust the alignment for the entire text line using the setLineAlignment method.
The text orientation may be controlled by utilizing the setOrientation method.
To set the font associated with the text object, please refer to the setFont method.
To set the text string for an annotation text object:
Annotations annots;
annots = new Annotations();
chart1.getExtensions().add(((IExtension)annots));
AnnotationText text;
text = new AnnotationText();
annots.getList().add(((AnnotationObject)text));
text.setText("Sample Text");
value - resetTextpublic java.awt.Color getTextColor()
Sets the color of the text for an annotation object.
You can set the text for an annotation text object using the setText method.
The horizontal text alignment may be modified using the setAlign method. You can adjust the alignment for the entire text line using the setLineAlignment method.
To set the font associated with the text object, please refer to the setFont method.
The text orientation may be controlled by utilizing the setOrientation method.
For more information regarding the Color type, please refer to the Java Documentation.
To set the color for the text of an annotation text object:
Annotations annots; annots = new Annotations(); chart1.getExtensions().add(((IExtension)annots)); AnnotationText text; text = new AnnotationText(); annots.getList().add(((AnnotationObject)text)); text.setTextColor(new java.awt.Color(0,0,255,255));
resetTextColorpublic void setTextColor(java.awt.Color value)
Sets the color of the text for an annotation object.
You can set the text for an annotation text object using the setText method.
The horizontal text alignment may be modified using the setAlign method. You can adjust the alignment for the entire text line using the setLineAlignment method.
To set the font associated with the text object, please refer to the setFont method.
The text orientation may be controlled by utilizing the setOrientation method.
For more information regarding the Color type, please refer to the Java Documentation.
To set the color for the text of an annotation text object:
Annotations annots; annots = new Annotations(); chart1.getExtensions().add(((IExtension)annots)); AnnotationText text; text = new AnnotationText(); annots.getList().add(((AnnotationObject)text)); text.setTextColor(new java.awt.Color(0,0,255,255));
value - resetTextColorpublic boolean isWordWrap()
Gets or sets a value indicating whether the text of an annotation text object will be word wrapped.
The isWordWrap method will allow developers to select whether the text of an AnnotationText object will wrap or be displayed as one line.
To disable word wrapping:
Annotations annots;
annots = new Annotations();
chart1.getExtensions().add(((IExtension)annots));
AnnotationText text;
text = new AnnotationText();
text.setText("The Text displayed by AnnotationText");
text.setTop(100);
text.setLeft(100);
text.setWordWrap(false);
text.sizeToFit();
annots.getList().add(((AnnotationObject)text));
public void setWordWrap(boolean value)
Gets or sets a value indicating whether the text of an annotation text object will be word wrapped.
The isWordWrap method will allow developers to select whether the text of an AnnotationText object will wrap or be displayed as one line.
To disable word wrapping:
Annotations annots;
annots = new Annotations();
chart1.getExtensions().add(((IExtension)annots));
AnnotationText text;
text = new AnnotationText();
text.setText("The Text displayed by AnnotationText");
text.setTop(100);
text.setLeft(100);
text.setWordWrap(false);
text.sizeToFit();
annots.getList().add(((AnnotationObject)text));
value - public void resetAlign()
setAlignpublic void resetFont()
setFontpublic void resetLineAlignment()
setLineAlignmentpublic void resetOrientation()
setOrientationpublic void resetText()
setTextpublic void resetTextColor()
setTextColorpublic void resetTextStyle()
public void sizeToFit()
Instructs Chart FX to resize a selected annotation text object to fit the configured text string.
Calling this method will instruct Chart FX to recalculate the configured setHeight and setWidth.
You can set the text for the annotation text object using the setText method. The text color may be modified using the setTextColor method.
To call the sizeToFit method for an annotation text object:
Annotations annots;
annots = new Annotations();
chart1.getExtensions().add(((IExtension)annots));
AnnotationText text;
text = new AnnotationText();
annots.getList().add(((AnnotationObject)text));
text.setText("my text string");
text.sizeToFit();
2014 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
All other names are trademarks or registered trademarks of their respective owners.