|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.AttributedString
public class AttributedString
This class models a String with attributes over various
subranges of the string. It allows applications to access this
information via the AttributedCharacterIterator interface.
| Constructor Summary | |
|---|---|
AttributedString(AttributedCharacterIterator aci)
Initializes a new instance of AttributedString
that will use the text and attribute information from the specified
AttributedCharacterIterator. |
|
AttributedString(AttributedCharacterIterator aci,
int begin_index,
int end_index)
Initializes a new instance of AttributedString
that will use the text and attribute information from the specified
subrange of the specified AttributedCharacterIterator. |
|
AttributedString(AttributedCharacterIterator aci,
int begin,
int end,
AttributedCharacterIterator.Attribute[] attributes)
Initializes a new instance of AttributedString
that will use the text and attribute information from the specified
subrange of the specified AttributedCharacterIterator. |
|
AttributedString(String str)
Creates a new instance of AttributedString
that represents the specified String with no attributes. |
|
AttributedString(String str,
Map attributes)
Creates a new instance of AttributedString
that represents that specified String with the specified
attributes over the entire length of the String. |
|
| Method Summary | |
|---|---|
void |
addAttribute(AttributedCharacterIterator.Attribute attrib,
Object value)
Adds a new attribute that will cover the entire string. |
void |
addAttribute(AttributedCharacterIterator.Attribute attrib,
Object value,
int begin,
int end)
Adds a new attribute that will cover the specified subrange of the string. |
void |
addAttributes(Map attributes,
int begin_index,
int end_index)
Adds all of the attributes in the specified list to the specified subrange of the string. |
AttributedCharacterIterator |
getIterator()
Returns an AttributedCharacterIterator that
will iterate over the entire string. |
AttributedCharacterIterator |
getIterator(AttributedCharacterIterator.Attribute[] attributes)
Returns an AttributedCharacterIterator that
will iterate over the entire string. |
AttributedCharacterIterator |
getIterator(AttributedCharacterIterator.Attribute[] attributes,
int begin_index,
int end_index)
Returns an AttributedCharacterIterator that
will iterate over the specified subrange. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AttributedString(String str)
AttributedString
that represents the specified String with no attributes.
str - The String to be attributed (null not
permitted).
NullPointerException - if str is null.
public AttributedString(String str,
Map attributes)
AttributedString
that represents that specified String with the specified
attributes over the entire length of the String.
str - The String to be attributed.attributes - The attribute list.public AttributedString(AttributedCharacterIterator aci)
AttributedString
that will use the text and attribute information from the specified
AttributedCharacterIterator.
aci - The AttributedCharacterIterator containing the
text and attribute information (null not
permitted).
NullPointerException - if aci is null.
public AttributedString(AttributedCharacterIterator aci,
int begin_index,
int end_index)
AttributedString
that will use the text and attribute information from the specified
subrange of the specified AttributedCharacterIterator.
aci - The AttributedCharacterIterator containing the
text and attribute information.begin_index - The beginning index of the text subrange.end_index - The ending index of the text subrange.
public AttributedString(AttributedCharacterIterator aci,
int begin,
int end,
AttributedCharacterIterator.Attribute[] attributes)
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.
aci - The AttributedCharacterIterator containing the
text and attribute information.begin - The beginning index of the text subrange.end - The ending index of the text subrange.attributes - A list of attributes to include from the iterator, or
null to include all attributes.| Method Detail |
|---|
public void addAttribute(AttributedCharacterIterator.Attribute attrib,
Object value)
attrib - The attribute to add.value - The value of the attribute.
public void addAttribute(AttributedCharacterIterator.Attribute attrib,
Object value,
int begin,
int end)
attrib - The attribute to add.value - The value of the attribute, which may be null.begin - The beginning index of the subrange.end - The ending index of the subrange.
IllegalArgumentException - If attribute is null or
the subrange is not valid.
public void addAttributes(Map attributes,
int begin_index,
int end_index)
attributes - The list of attributes.begin_index - The beginning index.end_index - The ending index
NullPointerException - if attributes is
null.
IllegalArgumentException - if the subrange is not valid.public AttributedCharacterIterator getIterator()
AttributedCharacterIterator that
will iterate over the entire string.
AttributedCharacterIterator for the entire string.public AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes)
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.
attributes - A list of attributes to include in the returned iterator.
AttributedCharacterIterator for this string.
public AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes,
int begin_index,
int end_index)
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.
attributes - A list of attributes to include in the returned iterator.begin_index - The beginning index of the subrange.end_index - The ending index of the subrange.
AttributedCharacterIterator for this string.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||