|
JavaTM 2 Platform Std. Ed. v1.4.0 |
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||||
java.lang.Object | +--javax.swing.text.DocumentFilter
DocumentFilter は、名前が示すように Document 変更メソッドのフィルタです。DocumentFilter を格納する Document が、insert または remove を介して変更されると、適当なメソッド呼び出しが DocumentFilter に転送されます。デフォルトの実装では、変更が可能です。サブクラスは、場合に応じてメソッドをスーパークラス上に呼び出すか、渡された FilterBypass に必要なメソッドを呼び出すことで、変更にフィルタを設定できます。サブクラスは、変更を Document にコールバックするのではなく、スーパークラスや FilterBypass への呼び出しを行う必要があります。
remove または insertString が DocumentFilter 上で呼び出されると、DocumentFilter は FilterBypass を複数回または異なる領域に対してコールバックできますが、remove または insertString メソッドから返された後に、FilterBypass へコールバックしてはなりません。
Document| 入れ子クラスの概要 | |
static class |
DocumentFilter.FilterBypass
Document へのコールバックを回避して、Document を変更する場合に使用されます。 |
| コンストラクタの概要 | |
DocumentFilter()
|
|
| メソッドの概要 | |
void |
insertString(DocumentFilter.FilterBypass fb,
int offset,
String string,
AttributeSet attr)
指定した Document にテキストを挿入する前に呼び出されます。 |
void |
remove(DocumentFilter.FilterBypass fb,
int offset,
int length)
指定した Document の指定した範囲を削除する前に呼び出されます。 |
void |
replace(DocumentFilter.FilterBypass fb,
int offset,
int length,
String text,
AttributeSet attrs)
指定した Document でテキストの範囲を置き換える前に呼び出されます。 |
| クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
public DocumentFilter()
| メソッドの詳細 |
public void remove(DocumentFilter.FilterBypass fb,
int offset,
int length)
throws BadLocationException
FilterBypass を必要に応じて直接呼び出します。
fb - Document の変更に使用する FilterBypassoffset - 先頭からのオフセット >= 0length - 削除対象の文字数 >= 0
BadLocationException - 削除範囲の一部がドキュメントの有効部分でなかった場合。例外内の位置は、最初に検出された不正な位置
public void insertString(DocumentFilter.FilterBypass fb,
int offset,
String string,
AttributeSet attr)
throws BadLocationException
fb - Document の変更に使用する FilterBypassoffset - コンテンツを挿入するドキュメントに対するオフセット >= 0。指定位置やその後の変更を追跡するすべての位置が移動string - 挿入する文字列attr - 挿入されたコンテンツに関連している属性。属性がない場合は null
BadLocationException - 指定された挿入の位置が、ドキュメント内の有効な位置ではない場合
public void replace(DocumentFilter.FilterBypass fb,
int offset,
int length,
String text,
AttributeSet attrs)
throws BadLocationException
fb - Document の変更に使用する FilterBypassoffset - Document での位置length - 削除するテキストの長さtext - 挿入するテキスト。null の場合、テキストは挿入されないattrs - 挿入されたテキストの属性を示す AttributeSet。null も可
BadLocationException - 指定された挿入の位置が、ドキュメント内の有効な位置ではない場合
|
JavaTM 2 Platform Std. Ed. v1.4.0 |
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||||
Java、Java 2D、および JDBC は米国ならびにその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.