Java 2D Text Methods

get/setTextBackgroundColor()

When setUseTextBackgroundColor() enables (true) drawing of a background color behind a text object, these methods get/set the background color for a specified text object. The default value is White.

SYNTAX:

Color getTextBackgroundColor (IdentObj idObj);
void setTextBackgroundColor (IdentObj idObj, Color col);

INPUT:

idObj; object ID returned by a getObject() method (e.g., getTitle())

col; A color specification

RETURN:

Color; background color of the specified text object.

EXAMPLE:

setUseTextBackgroundColor (getSubtitle(), true);
setTextBackgroundColor (getSubtitle(), new Color (128, 128, 255));

ALSO SEE:

get/setUseTextBackgroundColor()

get/setTextJustHoriz()

These methods get/set the horizontal alignment of a text object within its bounding box.

SYNTAX:

int getTextJustHoriz();
int getTextJustHoriz (IdentObj id);
void setTextJustHoriz (int newValue);
void setTextJustHoriz (IdentObj id, int newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getY1Label())

newValue; Text Justification (0...2) 0 = Left, 1 = Center, 2 = Right

RETURN:

int; 0...2. 0 = Left, 1 = Center, 2 = Right

EXAMPLE:

setDepthAngle (0);
setDepthRadius (0);
setDisplay (getTitleBox(), true);
setFillColor (getTitleBox(), new Color (255, 255, 255));
setSubtitleString ("");
setTextJustVert (getTitle(), 1);
setTextJustHoriz (getTitle(), 0);

setTextJustHoriz (getTitle(), 1);

NOTES:

If a specific object is not identified with the input parameter id, these methods get/set the associated value (if any) for the first item in the selection list.

ALSO SEE:

get/setTextJustVert()

get/setTextJustVert()

These methods get/set the vertical alignment of a text object within its bounding box.

SYNTAX:

int getTextJustVert();
int getTextJustVert (IdentObj id);
void setTextJustVert (int newValue);
void setTextJustVert (IdentObj id, int newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getY1Label())

newValue; Vertical Justification (0...2). 0 = Top, 1 = Center, 2 = Bottom

RETURN:

int; 0...2. 0 = Top, 1 = Center, 2 = Bottom

EXAMPLE 1:

setDepthAngle (0);
setDepthRadius (0);
setDisplay (getTitleBox(), true);
setFillColor (getTitleBox(), new Color (255, 255, 255));
setSubtitleString ("");
setTextJustVert (getTitle(), 0);

setDisplay (getTitleBox(), true);
setFillColor (getTitleBox(), new Color (255, 255, 255));
setSubtitleString ("");
setTextJustVert (getTitle(), 1);

NOTES:

If a specific object is not identified with the input parameter id, these methods get/set the associated value (if any) for the first item in the selection list.

ALSO SEE:

get/setTextJustHoriz()

get/setTextRotation()

These methods get/set the rotation angle of a text object.

SYNTAX:

int getTextRotation();
int getTextRotation (IdentObj id);
void setTextRotation (int newValue);
void setTextRotation (IdentObj id, int newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getY1Label())

newValue; Text Rotation (0...2). 0 = None, 1 = 90 Degrees, 2 = 270 Degrees

RETURN:

int; 0...2. 0 = None, 1 = 90 Degrees, 2 = 270 Degrees

EXAMPLE:

setDepthRadius (0);
setUseSampleData (false);
setData (0, 0, 20);
setData (0, 1, 36);
setData (1, 0, 33);
setData (1, 1, 39);
setDataRangeToExtent();
setTextJustHoriz (getTitle(), 0);
setTextJustHoriz (getSubtitle(), 1);
setTextJustHoriz (getFootnote(), 2);
setTextRotation (getY1Label(), 1);

NOTES:

If a specific object is not identified with the input parameter id, these methods get/set the associated value (if any) for the first item in the selection list.

ALSO SEE:

O1/O2LabelRotate, X1/Y1/Y2LabelRotate

get/setTextStrikethrough()

These methods get/set text strike through mode for a specified text object. The default value is FALSE.

SYNTAX:

boolean getTextStrikethrough (IdentObj idObj);
void setTextStrikethrough (IdentObj idObj, boolean newValue);

INPUT:

idObj; object ID returned by a getObject() method (e.g., getTitle())

newValue; true = enable strike-through, false = disable strike-through

RETURN:

boolean; true = strike-through has been applied to the specified text object, false = strike-through not applied

EXAMPLE:

setUseTextBackgroundColor (getSubtitle(), true);
setTextBackgroundColor (getSubtitle(), new Color (128, 128, 255));
setTextStrikethrough (getSubtitle(), true);

get/setTextUnderlineType()

These methods get/set an underline style/type for a text object. The default value is UNDERLINE_LOW_TWO_PIXEL. The setFontStyle() method must be used to enable an underline font style.

SYNTAX:

int getTextUnderlineType (IdentObj id);
void setTextUnderlineType (IdentObj id, int newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getTitle())

newValue; set to one of the following:

UNDERLINE_LOW_ONE_PIXEL = 1
UNDERLINE_LOW_TWO_PIXEL = 2
UNDERLINE_LOW_DOTTED = 3
UNDERLINE_LOW_GRAY = 4
UNDERLINE_LOW_DASHED = 5

RETURN:

int; 1...5

EXAMPLE:

// Turn underline on by setting one of the Font Styles
setFontStyle (getSubtitle(), 4); 
// For UNDERLINE_LOW_DASHED
setTextUnderlineType (getSubtitle(), 5);

ALSO SEE:

get/setFontStyle()

get/setTextWrap()

These methods get/set line wrapping for a text object. When text wrapping is enabled, the charting engine will look for space characters in the text string and draw the text on multiple lines at space character boundaries. When text wrapping is disabled, the text string will always be drawn on a single line.

SYNTAX:

boolean getTextWrap();
boolean getTextWrap (IdentObj id);
void setTextWrap (boolean newValue);
void setTextWrap (IdentObj id, boolean newValue);

INPUT:

id; object ID returned by a getObject() method (e.g., getO1Label())

newValue; true = Text wrapping enabled, false = Text wrapping not enabled

RETURN:

boolean; true = Text wrapping enabled, false = Text wrapping not enabled

EXAMPLE:

setAutofit (getSubtitle(), false);
setFontSizeVC (getSubtitle(), 1855);
setRect (getSubtitle(), new Rectangle (-13278, 10471, 25806, 3710));
setTextString (getSubtitle(), "This is a very long Chart SubTitle that should be wrapped");
setTextWrap (getSubtitle(), true);
setDepthRadius (0);

NOTES:

ALSO SEE:

O1/O2LabelWrap

get/setUseTextBackgroundColor()

These methods get/set usage of the background color for a text object that can be set by setTextBackgroundColor(). When disabled (false), the background color of a text object is ignored. When enabled (true), the background color of a specified text object is applied. The default value is FALSE.

SYNTAX:

boolean getUseTextBackgroundColor (IdentObj idObj);
void setUseTextBackgroundColor (IdentObj idObj, boolean newValue);

INPUT:

idObj; object ID returned by a getObject() method (e.g., getTitle())

newValue; true = apply background color, false = do not apply background color

RETURN:

boolean; true = background color can be applied to the specified text object, false = background color is disabled

EXAMPLE:

setUseTextBackgroundColor (getTitle(), false);
setUseTextBackgroundColor (getSubtitle(), true);
setTextBackgroundColor (getSubtitle(), new Color (255, 255, 0));