java.text
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.
AttributedString(String str) - Creates a new instance of
AttributedString
that represents the specified String with no attributes.
|
AttributedString(String str, extends Attribute, ?> attributes) - Creates a new instance of
AttributedString
that represents that specified String with the specified
attributes over the entire length of the String .
|
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 beginIndex, int endIndex) - 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, Attribute[] attributes) - Initializes a new instance of
AttributedString
that will use the text and attribute information from the specified
subrange of the specified AttributedCharacterIterator .
|
void | addAttribute(Attribute attrib, Object value) - Adds a new attribute that will cover the entire string.
|
void | addAttribute(Attribute attrib, Object value, int begin, int end) - Adds a new attribute that will cover the specified subrange
of the string.
|
void | addAttributes(extends Attribute, ?> attributes, int beginIndex, int endIndex) - 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(Attribute[] attributes) - Returns an
AttributedCharacterIterator that
will iterate over the entire string.
|
AttributedCharacterIterator | getIterator(Attribute[] attributes, int beginIndex, int endIndex) - Returns an
AttributedCharacterIterator that
will iterate over the specified subrange.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
AttributedString
public AttributedString(String str)
Creates a new instance of AttributedString
that represents the specified String
with no attributes.
str
- The String
to be attributed (null
not
permitted).
AttributedString
public AttributedString(String str,
extends Attribute,
?> attributes)
Creates a new instance of 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.
AttributedString
public AttributedString(AttributedCharacterIterator aci)
Initializes a new instance of 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).
AttributedString
public AttributedString(AttributedCharacterIterator aci,
int beginIndex,
int endIndex)
Initializes a new instance of 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.beginIndex
- The beginning index of the text subrange.endIndex
- The ending index of the text subrange.
AttributedString
public AttributedString(AttributedCharacterIterator aci,
int begin,
int end,
Attribute[] attributes)
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.
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.
addAttribute
public void addAttribute(Attribute attrib,
Object value)
Adds a new attribute that will cover the entire string.
attrib
- The attribute to add.value
- The value of the attribute.
addAttribute
public void addAttribute(Attribute attrib,
Object value,
int begin,
int end)
Adds a new attribute that will cover the specified subrange
of the string.
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.
addAttributes
public void addAttributes(extends Attribute,
?> attributes,
int beginIndex,
int endIndex)
Adds all of the attributes in the specified list to the
specified subrange of the string.
attributes
- The list of attributes.beginIndex
- The beginning index.endIndex
- The ending index
getIterator
public AttributedCharacterIterator getIterator()
Returns an AttributedCharacterIterator
that
will iterate over the entire string.
- An
AttributedCharacterIterator
for the entire string.
getIterator
public AttributedCharacterIterator getIterator(Attribute[] attributes)
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.
attributes
- A list of attributes to include in the returned iterator.
- An
AttributedCharacterIterator
for this string.
getIterator
public AttributedCharacterIterator getIterator(Attribute[] attributes,
int beginIndex,
int endIndex)
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.
attributes
- A list of attributes to include in the returned iterator.beginIndex
- The beginning index of the subrange.endIndex
- The ending index of the subrange.
- An
AttributedCharacterIterator
for this string.
AttributedString.java -- Models text with attributes
Copyright (C) 1998, 1999, 2004, 2005, 2006, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.