public final class StringContent extends Object implements AbstractDocument.Content, Serializable
代わりに、ギャップバッファーまたはピーステーブルの実装を使うことをお勧めします。このバッファーはサイズが大きくなりません。
警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースとの互換性がなくなる予定です。現在の直列化のサポートは、短期間の格納や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。1.4 以降、すべての JavaBeansTM 用の長期間の格納サポートが java.beans パッケージに追加されています。XMLEncoder を参照してください。
| コンストラクタと説明 |
|---|
StringContent()
新しい StringContent オブジェクトを作成します。
|
StringContent(int initialLength)
指定された初期サイズで新しい StringContent オブジェクトを作成します。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
Position |
createPosition(int offset)
コンテンツが変更されたときに変更を追跡するコンテンツ内の位置を作成します。
|
void |
getChars(int where, int len, Segment chars)
コンテンツの一部を取り出します。
|
protected Vector |
getPositionsInRange(Vector v, int offset, int length)
offset から offset + length の範囲にある位置に対応する UndoPosRef のインスタンスを含むベクターを返します。 |
String |
getString(int where, int len)
コンテンツの一部を取り出します。
|
UndoableEdit |
insertString(int where, String str)
コンテンツに文字列を挿入します。
|
int |
length()
コンテンツの長さを返します。
|
UndoableEdit |
remove(int where, int nitems)
コンテンツの一部を削除します。
|
protected void |
updateUndoPositions(Vector positions)
positions のすべての UndoPosRef インスタンスの位置をリセットします。 |
public StringContent()
public StringContent(int initialLength)
initialLength - 初期サイズpublic int length()
length、インタフェース: AbstractDocument.ContentAbstractDocument.Content.length()public UndoableEdit insertString(int where, String str) throws BadLocationException
insertString、インタフェース: AbstractDocument.Contentwhere - 開始位置 >= 0 && < length()str - 挿入する null 以外の文字列BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.insertString(int, java.lang.String)public UndoableEdit remove(int where, int nitems) throws BadLocationException
remove、インタフェース: AbstractDocument.Contentwhere - 開始位置 >= 0nitems - 削除対象の文字数 >= 0BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.remove(int, int)public String getString(int where, int len) throws BadLocationException
getString、インタフェース: AbstractDocument.Contentwhere - 開始位置 >= 0len - 取り出す長さ >= 0BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.getString(int, int)public void getChars(int where,
int len,
Segment chars)
throws BadLocationException
getChars、インタフェース: AbstractDocument.Contentwhere - 開始位置 >= 0len - 取得対象の文字数 >= 0chars - 文字を返す先の Segment オブジェクトBadLocationException - 指定された位置が無効な場合AbstractDocument.Content.getChars(int, int, javax.swing.text.Segment)public Position createPosition(int offset) throws BadLocationException
createPosition、インタフェース: AbstractDocument.Contentoffset - 位置を作成するオフセット >= 0BadLocationException - 指定された位置が無効な場合protected Vector getPositionsInRange(Vector v, int offset, int length)
offset から offset + length の範囲にある位置に対応する UndoPosRef のインスタンスを含むベクターを返します。v が null ではない場合、一致する位置がそこに配置されます。結果として得られる位置を持つベクタが返されます。
これは内部での使用を目的としていて、一般にはサブクラスを対象にしていません。
v - 使用するベクタ。null の場合は新しいベクタが作成されるoffset - 開始オフセット >= 0length - 長さ >= 0protected void updateUndoPositions(Vector positions)
positions のすべての UndoPosRef インスタンスの位置をリセットします。
これは内部での使用を目的としていて、一般にはサブクラスを対象にしていません。
positions - インスタンスの位置 バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.