All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.text.AttributedString

java.lang.Object
    |
    +----java.text.AttributedString

public class AttributedString
extends Object
An AttributedString holds text and related attribute information. It may be used as the actual data storage in some cases where a text reader wants to access attributed text through the AttributedCharacterIterator interface.

See Also:
AttributedCharacterIterator, Annotation

Constructor Index

 o AttributedString(String)
Constructs an AttributedString instance with the given text.

Method Index

 o addAttribute(String, int, int, Object)
Adds an attribute to the string.
 o getIterator()
Creates an AttributedCharacterIterator instance that provides access to the entire contents of this string.
 o getIterator(int, int, String[])
Creates an AttributedCharacterIterator instance that provides access to selected contents of this string.
 o getIterator(String[])
Creates an AttributedCharacterIterator instance that provides access to selected contents of this string.

Constructors

 o AttributedString
public AttributedString(String text)
Constructs an AttributedString instance with the given text.

Methods

 o addAttribute
public void addAttribute(String attributeName,
                         int beginIndex,
                         int endIndex,
                         Object value)
Adds an attribute to the string.

Parameters:
attributeName - The name of the attribute
beginIndex - Index of the first character of the range
endIndex - Index of the character following the last character of the range
value - The value of the attribute
 o getIterator
public AttributedCharacterIterator getIterator()
Creates an AttributedCharacterIterator instance that provides access to the entire contents of this string.

Returns:
an iterator providing access to the text and its attributes
 o getIterator
public AttributedCharacterIterator getIterator(String[] attributeNames)
Creates an AttributedCharacterIterator instance that provides access to selected contents of this string. Information about attributes not listed in attributeNames that the implementor may have need not be made accessible through the iterator.

Parameters:
attributeNames - A list of attributes that the client is interested in
Returns:
An iterator providing access to the text and its attributes
 o getIterator
public AttributedCharacterIterator getIterator(int beginIndex,
                                               int endIndex,
                                               String[] attributeNames)
Creates an AttributedCharacterIterator instance that provides access to selected contents of this string. Information about attributes not listed in attributeNames that the implementor may have need not be made accessible through the iterator. If the list is null, all available attribute information should be made accessible.

Parameters:
beginIndex - the index of the first character
endIndex - the index of the character following the last character
attributeNames - a list of attributes that the client is interested in
Returns:
an iterator providing access to the text and its attributes

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature