クラスDocumentFilter.FilterBypass
java.lang.Object
javax.swing.text.DocumentFilter.FilterBypass
- 含まれているクラス:
DocumentFilter
public abstract static class DocumentFilter.FilterBypass extends Object
Documentへのコールバックを回避して、Documentを変更する場合に使用されます。 DocumentFilterをサポートするDocument実装では、次のメソッドがDocumentFilterから呼び出されたときに、DocumentFilterへのコールバックを実行しないようにする必要があります。
- 導入されたバージョン:
- 1.4
-
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
修飾子と型メソッド説明abstract Document変更が行われているDocumentを返します。abstract voidinsertString(int offset, String string, AttributeSet attr) DocumentFilterをバイパスして、指定テキストを挿入します。abstract voidremove(int offset, int length) DocumentFilterをバイパスして、テキストの指定領域を削除します。abstract voidreplace(int offset, int length, String string, AttributeSet attrs) offsetからoffset+lengthまでのテキスト領域を削除し、textに置き換えます。
-
コンストラクタの詳細
-
FilterBypass
protected FilterBypass()サブクラスが呼び出すためのコンストラクタ。
-
-
メソッドの詳細
-
getDocument
public abstract Document getDocument()変更が行われているDocumentを返します。- 戻り値:
- removeStringやinsertStringが実行されるDocument
-
remove
public abstract void remove(int offset, int length) throws BadLocationException DocumentFilterをバイパスして、テキストの指定領域を削除します。- パラメータ:
offset- 先頭からのオフセット>= 0length- 削除対象の文字数>= 0- スロー:
BadLocationException- 削除範囲の一部がドキュメントの有効な部分でなかった場合。 例外内の位置は、最初に検出された不正な位置。
-
insertString
public abstract void insertString(int offset, String string, AttributeSet attr) throws BadLocationException DocumentFilterをバイパスして、指定テキストを挿入します。- パラメータ:
offset- コンテンツを挿入するドキュメント内のオフセット。0以上。 指定位置やその後ろの変更を追跡するすべての位置が移動します。string- 挿入する文字列attr- 挿入されたコンテンツに関連付ける属性。 属性がない場合はnullも可。- スロー:
BadLocationException- 指定された挿入位置がドキュメント内の有効な位置でない場合
-
replace
public abstract void replace(int offset, int length, String string, AttributeSet attrs) throws BadLocationException offsetからoffset+lengthまでのテキスト領域を削除し、textに置き換えます。- パラメータ:
offset- Documentでの位置length- 削除するテキストの長さstring- 挿入するテキスト。nullの場合、テキストは挿入されないattrs- 挿入されたテキストの属性を示すAttributeSet。nullも可。- スロー:
BadLocationException- 指定された挿入位置がドキュメント内の有効な位置でない場合
-