Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 654
نمايش فراداده

AttributedStringjava.text

Java 1.2

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,?>

attributes , int

beginIndex , int

endIndex ); public AttributedCharacterIterator

getIterator ( ); public AttributedCharacterIterator

getIterator (AttributedCharacterIterator.Attribute[ ]

attributes ); public AttributedCharacterIterator

getIterator (AttributedCharacterIterator.Attribute[ ]

attributes , int

beginIndex , int

endIndex ); }