Name
AttributedString
Synopsis
This class represents text
and associated attributes. An AttributedString
can
be defined in terms of an underlying
AttributedCharacterIterator
or an underlying
String
. Additional attributes can be specified
with the addAttribute( )
and
addAttributes( )
methods. getIterator(
)
returns an AttributedCharacterIterator
over the AttributedString
or over a specified
portion of the string. Note that two of the getIterator(
)
methods take an array of Attribute
keys as an argument. These methods return an
AttributedCharacterIterator
that ignores all
attributes that are not in the specified array. If the array argument
is null
, however, the returned iterator contains
all attributes.
public class AttributedString { // Public Constructors public AttributedString(String text); public AttributedString(AttributedCharacterIterator text); public AttributedString(String text, java.util.Map<? extends AttributedCharacterIterator.Attribute,?> attributes); public AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex); public AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[ ] attributes); // Public Instance Methods public void addAttribute(AttributedCharacterIterator.Attribute attribute, Object value); public void addAttribute(AttributedCharacterIterator.Attribute attribute, Object value, int beginIndex, int endIndex); public void addAttributes(java.util.Map<? extends AttributedCharacterIterator.Attribute,?> ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.