java.text
Class AttributedString
java.lang.Object
|
+--java.text.AttributedString
public class
AttributedStringextends
Object This class models a String
with attributes over various
subranges of the string. It allows applications to access this
information via the AttributedCharcterIterator
interface.
Author:- Aaron M. Renn (arenn@urbanophile.com)
AttributedString
public AttributedString(java.lang.String str)
This method initializes a new instance of AttributedString
that represents the specified String
with no attributes.
Parameters:
AttributedString
public AttributedString(java.lang.String str, java.util.Map attributes)
This method initializes a new instance of AttributedString
that represents that specified String
with the specified
attributes over the entire length of the String
.
Parameters:
AttributedString
public AttributedString(java.text.AttributedCharacterIterator aci)
This method initializes a new instance of AttributedString
that will use the text and attribute information from the specified
AttributedCharacterIterator
.
Parameters:
AttributedString
public AttributedString(java.text.AttributedCharacterIterator aci, int begin_index, int end_index)
This method initializes a new instance of AttributedString
that will use the text and attribute information from the specified
subrange of the specified AttributedCharacterIterator
.
Parameters:
AttributedString
public AttributedString(java.text.AttributedCharacterIterator aci, int begin_index, int end_index, java.text.AttributedCharacterIterator.Attribute[] attributes)
This method initializes a new instance of AttributedString
that will use the text and attribute information from the specified
subrange of the specified AttributedCharacterIterator
.
Only attributes from the source iterator that are present in the
specified array of attributes will be included in the attribute list
for this object.
Parameters:
addAttribute
public void addAttribute(java.text.AttributedCharacterIterator.Attribute attrib, java.lang.Object value)
This method adds a new attribute that will cover the entire string.
Parameters:
addAttribute
public void addAttribute(java.text.AttributedCharacterIterator.Attribute attrib, java.lang.Object value, int begin_index, int end_index)
This method adds a new attribute that will cover the specified subrange
of the string.
Parameters:
Throws:
addAttributes
public void addAttributes(java.util.Map attributes, int begin_index, int end_index)
This method adds all of the attributes in the specified list to the
specified subrange of the string.
Parameters:
getIterator
public AttributedCharacterIterator getIterator()
This method returns an AttributedCharacterIterator
that
will iterate over the entire string.
Returns:
- An
AttributedCharacterIterator
for the entire string.
getIterator
public AttributedCharacterIterator getIterator(java.text.AttributedCharacterIterator.Attribute[] attributes)
This method returns an AttributedCharacterIterator
that
will iterate over the entire string. This iterator will return information
about the list of attributes in the specified array. Attributes not in
the array may or may not be returned by the iterator. If the specified
array is null
, all attributes will be returned.
Parameters:
Returns:
- An
AttributedCharacterIterator
for this string.
getIterator
public AttributedCharacterIterator getIterator(java.text.AttributedCharacterIterator.Attribute[] attributes, int begin_index, int end_index)
This method returns an AttributedCharacterIterator
that
will iterate over the specified subrange. This iterator will return information
about the list of attributes in the specified array. Attributes not in
the array may or may not be returned by the iterator. If the specified
array is null
, all attributes will be returned.
Parameters:
Returns:
- An
AttributedCharacterIterator
for this string.
String
with attributes over various subranges of the string. It allows applications to access this information via theAttributedCharcterIterator
interface.