|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.swing.text.StringContent
public final class StringContent
比較的小さなドキュメントおよびデバッグには便利な、強引な実装である AbstractDocument.Content インタフェースの実装です。これは、文字コンテンツを単純な文字配列として管理します。これも効率的ではありません。
代わりに、ギャップバッファまたはピーステーブルの実装を使うことをお勧めします。このバッファはサイズが大きくなりません。
警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。JDK バージョン 1.4 以降、すべての JavaBeans™ の長期間の運用サポートは、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 インスタンスの位置をリセットします。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public StringContent()
public StringContent(int initialLength)
initialLength - 初期サイズ| メソッドの詳細 |
|---|
public int length()
AbstractDocument.Content 内の lengthAbstractDocument.Content.length()
public UndoableEdit insertString(int where,
String str)
throws BadLocationException
AbstractDocument.Content 内の insertStringwhere - 開始位置 >= 0 && < length()str - 挿入する null 以外の文字列
BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.insertString(int, java.lang.String)
public UndoableEdit remove(int where,
int nitems)
throws BadLocationException
AbstractDocument.Content 内の removewhere - 開始位置 >= 0nitems - 削除対象の文字数 >= 0
BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.remove(int, int)
public String getString(int where,
int len)
throws BadLocationException
AbstractDocument.Content 内の getStringwhere - 開始位置 >= 0len - 取り出す長さ >= 0
BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.getString(int, int)
public void getChars(int where,
int len,
Segment chars)
throws BadLocationException
AbstractDocument.Content 内の getCharswhere - 開始位置 >= 0len - 検索対象の文字数 >= 0chars - 文字を返す先の Segment オブジェクト
BadLocationException - 指定された位置が無効な場合AbstractDocument.Content.getChars(int, int, javax.swing.text.Segment)
public Position createPosition(int offset)
throws BadLocationException
AbstractDocument.Content 内の createPositionoffset - 位置を作成するオフセット >= 0
BadLocationException - 指定された位置が無効な場合
protected Vector getPositionsInRange(Vector v,
int offset,
int length)
offset 〜 offset + length の範囲にある位置に対応する UndoPosRef のインスタンスを含むベクタを返します。v が null ではない場合、一致する位置がそこに配置されます。結果の位置を持つベクタが返されます。
これは内部での使用を目的としていて、一般にはサブクラスを対象にしていません。
v - 使用するベクタ。null の場合は新しいベクタが作成されるoffset - 開始オフセット >= 0length - 長さ >= 0
protected void updateUndoPositions(Vector positions)
positions のすべての UndoPosRef インスタンスの位置をリセットします。
これは内部での使用を目的としていて、一般にはサブクラスを対象にしていません。
positions - インスタンスの位置
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。