TextRun

Inheritance: java.lang.Object

public class TextRun

The class representing a piece of text with associated style.

Constructors

ConstructorDescription
TextRun(String text, TextStyle style)Initializes a new instance of the TextRun class.
TextRun(String text)Initializes a new instance of the TextRun class with default style.
TextRun(TextStyle style)Initializes a new instance of the TextRun class with empty text.
TextRun()Initializes a new instance of the TextRun class with empty text and default style.

Methods

MethodDescription
getText()Gets the text.
setText(String value)Sets the text.
getStyle()Gets the style.
setStyle(TextStyle value)Sets the style.
getLength()Gets the length of the associated text.

TextRun(String text, TextStyle style)

public TextRun(String text, TextStyle style)

Initializes a new instance of the TextRun class.

Parameters:

ParameterTypeDescription
textjava.lang.StringThe associated text.
styleTextStyleThe style.

TextRun(String text)

public TextRun(String text)

Initializes a new instance of the TextRun class with default style.

Parameters:

ParameterTypeDescription
textjava.lang.StringThe associated text.

TextRun(TextStyle style)

public TextRun(TextStyle style)

Initializes a new instance of the TextRun class with empty text.

Parameters:

ParameterTypeDescription
styleTextStyleThe style.

TextRun()

public TextRun()

Initializes a new instance of the TextRun class with empty text and default style.

getText()

public final String getText()

Gets the text.

Returns: java.lang.String

setText(String value)

public final void setText(String value)

Sets the text.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getStyle()

public final TextStyle getStyle()

Gets the style.

Returns: TextStyle

setStyle(TextStyle value)

public final void setStyle(TextStyle value)

Sets the style.

Parameters:

ParameterTypeDescription
valueTextStyle

getLength()

public final int getLength()

Gets the length of the associated text.

Returns: int