public class AttributedString extends Object
属性はキーと値のペアであり、キーで識別されます。1つの文字に対して複数の属性キーを定義することはできません。
属性の値は不変です。つまり、クライアントやストレージによって変更できません。属性の値は常に参照渡しです。複製されることはありません。
AttributedCharacterIterator, Annotation| コンストラクタと説明 |
|---|
AttributedString(AttributedCharacterIterator text)
指定されたAttributedCharacterIteratorが表現する属性付きテキストを持つ、AttributedStringインスタンスを構築します。
|
AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex)
指定されたAttributedCharacterIteratorが表現する属性付きテキストの部分範囲を持つAttributedStringインスタンスを構築します。
|
AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes)
指定されたAttributedCharacterIteratorが表現する属性付きテキストの部分範囲を持つAttributedStringインスタンスを構築します。
|
AttributedString(String text)
指定されたテキストを持つAttributedStringインスタンスを構築します。
|
AttributedString(String text, Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
指定されたテキストと属性を持つAttributedStringインスタンスを構築します。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
void |
addAttribute(AttributedCharacterIterator.Attribute attribute, Object value)
属性を文字列全体に追加します。
|
void |
addAttribute(AttributedCharacterIterator.Attribute attribute, Object value, int beginIndex, int endIndex)
属性を文字列の部分範囲に追加します。
|
void |
addAttributes(Map<? extends AttributedCharacterIterator.Attribute,?> attributes, int beginIndex, int endIndex)
一連の属性を文字列の部分範囲に追加します。
|
AttributedCharacterIterator |
getIterator()
この文字列の内容全体にアクセスできるAttributedCharacterIteratorインスタンスを作成します。
|
AttributedCharacterIterator |
getIterator(AttributedCharacterIterator.Attribute[] attributes)
この文字列の選択された内容にアクセスできるAttributedCharacterIteratorインスタンスを作成します。
|
AttributedCharacterIterator |
getIterator(AttributedCharacterIterator.Attribute[] attributes, int beginIndex, int endIndex)
この文字列の選択された内容にアクセスできるAttributedCharacterIteratorインスタンスを作成します。
|
public AttributedString(String text)
text - この属性付き文字列のテキスト。NullPointerException - textがnullである場合。public AttributedString(String text, Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
text - この属性付き文字列のテキスト。attributes - 文字列全体に適用する属性。NullPointerException - textまたはattributesがnullの場合。IllegalArgumentException - テキスト長が0で、かつ属性パラメータが空のMapでない場合(長さ0の範囲には属性を適用できない)。public AttributedString(AttributedCharacterIterator text)
text - この属性付き文字列のテキスト。NullPointerException - textがnullである場合。public AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex)
text - この属性付き文字列のテキスト。beginIndex - 範囲の先頭文字のインデックス。endIndex - 範囲の末尾文字の次の文字のインデックス。NullPointerException - textがnullである場合。IllegalArgumentException - beginIndexとendIndexで指定された部分範囲がテキストの範囲外にある場合。Annotationpublic AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes)
text - この属性付き文字列のテキスト。beginIndex - 範囲の先頭文字のインデックス。endIndex - 範囲の末尾文字の次の文字のインデックス。attributes - テキストから抽出する属性を指定する。nullが指定された場合、利用可能なすべての属性が使用される。NullPointerException - textがnullである場合。IllegalArgumentException - beginIndexとendIndexで指定された部分範囲がテキストの範囲外にある場合。Annotationpublic void addAttribute(AttributedCharacterIterator.Attribute attribute, Object value)
attribute - 属性キーvalue - 属性の値。nullも指定可能NullPointerException - attributeがnullである場合。IllegalArgumentException - AttributedStringの長さが0の場合(長さ0の範囲には属性を適用できない)。public void addAttribute(AttributedCharacterIterator.Attribute attribute, Object value, int beginIndex, int endIndex)
attribute - 属性キーvalue - 属性の値。nullも可。beginIndex - 範囲の先頭文字のインデックス。endIndex - 範囲の末尾文字の次の文字のインデックス。NullPointerException - attributeがnullである場合。IllegalArgumentException - eginIndexが0より小さい場合、endIndexが文字列長より大きい場合、あるいはbeginIndexとendIndexで定義される文字列の部分範囲が空になる場合。public void addAttributes(Map<? extends AttributedCharacterIterator.Attribute,?> attributes, int beginIndex, int endIndex)
attributes - 文字列に追加する属性。beginIndex - 範囲の先頭文字のインデックス。endIndex - 範囲の末尾文字の次の文字のインデックス。NullPointerException - attributesがnullである場合。IllegalArgumentException - beginIndexが0より小さい場合、endIndexが文字列長より大きい場合、あるいはbeginIndexとendIndexで定義される文字列の部分範囲が空になり、かつ属性パラメータが空のMapでない場合。public AttributedCharacterIterator getIterator()
public AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes)
attributes - クライアントが興味を持っている属性のリストpublic AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes, int beginIndex, int endIndex)
attributes - クライアントが興味を持っている属性のリストbeginIndex - 最初の文字のインデックスendIndex - 最後の文字のあとに続く文字のインデックスIllegalArgumentException - beginIndexが0より小さい場合、endIndexが文字列長より大きい場合、あるいはbeginIndexがendIndexより大きい場合。 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.