TextFormat Class

TextFormat Class

This Package | All Packages

public class TextFormat

Provides different ways for text to be formatted.

Fields
Name Description
ALL All viable flags in the bit mask.
BOTTOM Formats the text along the bottom of the rectangle.
EDITCONTROL Draws the text in the same manner as a Windows Edit control does.
ENDELLIPSIS Puts an ellipsis at the end of the text if it is too long to fit into the rectangle.
EXPANDTABS Expands tabs in the text.
HORIZONTALCENTER Centers the text horizontally.
LEFT Aligns the text to the left.
NOPREFIX Automatically breaks words at the end of the line.
PATHELLIPSIS Puts an ellipsis in the middle of the text, properly breaking the text with appropriate backslashes.
RIGHT Aligns the text to the right.
RIGHTTOLEFT The text is laid from right to left, as when using Hebrew or Arabic fonts.
SINGLELINE Automatically breaks words at the end of the line.
TOP Aligns text to the top of the rectangle.
VERTICALCENTER Vertically aligns text.
WORDBREAK Automatically breaks words at the end of the line.
WORDELLIPSIS Puts an ellipsis at the end of the text at a word break if the text is too long to fit in the rectangle.

Methods
Name Description
ensureValid(int format) Throws an exception if the given value is not possible for this class.
valid(int format) Determines whether the specified format is valid for this class.

Fields

TextFormat.ALL

Syntax
public static final int ALL;
Description
All viable flags in the bit mask.

TextFormat.BOTTOM

Syntax
public static final int BOTTOM;
Description
Formats the text along the bottom of the rectangle.

TextFormat.EDITCONTROL

Syntax
public static final int EDITCONTROL;
Description
Draws the text in the same manner as a Windows Edit control does. The average character width is calculated in the same manner, and the last line of multiline text is not drawn if it would be only partially visible.

TextFormat.ENDELLIPSIS

Syntax
public static final int ENDELLIPSIS;
Description
Puts an ellipsis at the end of the text if it is too long to fit into the rectangle.

TextFormat.EXPANDTABS

Syntax
public static final int EXPANDTABS;
Description
Expands tabs in the text.

TextFormat.HORIZONTALCENTER

Syntax
public static final int HORIZONTALCENTER;
Description
Centers the text horizontally.

TextFormat.LEFT

Syntax
public static final int LEFT;
Description
Aligns the text to the left.

TextFormat.NOPREFIX

Syntax
public static final int NOPREFIX;
Description
Automatically breaks words at the end of the line.

TextFormat.PATHELLIPSIS

Syntax
public static final int PATHELLIPSIS;
Description
Puts an ellipsis in the middle of the text, properly breaking the text with appropriate backslashes.

TextFormat.RIGHT

Syntax
public static final int RIGHT;
Description
Aligns the text to the right.

TextFormat.RIGHTTOLEFT

Syntax
public static final int RIGHTTOLEFT;
Description
The text is laid from right to left, as when using Hebrew or Arabic fonts.

TextFormat.SINGLELINE

Syntax
public static final int SINGLELINE;
Description
Automatically breaks words at the end of the line.

TextFormat.TOP

Syntax
public static final int TOP;
Description
Aligns text to the top of the rectangle.

TextFormat.VERTICALCENTER

Syntax
public static final int VERTICALCENTER;
Description
Vertically aligns text.

TextFormat.WORDBREAK

Syntax
public static final int WORDBREAK;
Description
Automatically breaks words at the end of the line.

TextFormat.WORDELLIPSIS

Syntax
public static final int WORDELLIPSIS;
Description
Puts an ellipsis at the end of the text at a word break if the text is too long to fit in the rectangle.

Methods

TextFormat.ensureValid

Syntax
public static void ensureValid( int format );
Parameters
format
Topic under construction.
Description

Throws an exception if the given value is not possible for this class.

TextFormat.valid

Syntax
public static boolean valid( int format );
Parameters
format
The format.
Return Value

Returns true if the given value is a valid format; otherwise, returns false.

Description

Determines whether the specified format is valid for this class.