|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.swing.text.DocumentFilter
public class 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 Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。