JavaTM Platform
Standard Ed. 6

javax.swing.text
클래스 DocumentFilter

java.lang.Object 
  상위를 확장 javax.swing.text.DocumentFilter


public class DocumentFilter
extends Object

DocumentFilter 는, 이름이 가리키도록(듯이) Document 변경 메소드의 필터입니다. DocumentFilter 를 포함하는 Document 가,insert 또는 remove 를 개입시켜 변경되면(자), 적당한 메소드 호출이 DocumentFilter 에 전송 됩니다. 디폴트의 구현에서는, 변경이 가능합니다. 서브 클래스는, 경우에 응해 메소드를 슈퍼 클래스상에 호출하는지, 건네받은 FilterBypass 에 필요한 메소드를 호출하는 것으로, 변경에 필터를 설정할 수 있습니다. 서브 클래스는, 변경을 Document 에 콜백 하는 것이 아니라, 슈퍼 클래스나 FilterBypass 에의 호출을 실시할 필요가 있습니다.

remove 또는 insertStringDocumentFilter 상에서 불려 가면(자),DocumentFilterFilterBypass 를 여러 차례 또는 다른 영역에 대해서 콜백 할 수 있습니다만,remove 또는 insertString 메소드로부터 반환된 뒤에,FilterBypass 에 콜백 해서는 안됩니다.

도입된 버젼:
1.4
관련 항목:
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
 

생성자 의 상세

DocumentFilter

public DocumentFilter()
메소드의 상세

remove

public void remove(DocumentFilter.FilterBypass  fb,
                   int offset,
                   int length)
            throws BadLocationException 
지정한 Document 의 지정한 범위를 삭제하기 전에 불려 갑니다. 조건부로 삭제가 허가되는 서브 클래스는, 이 메소드를 오버라이드(override) 해 슈퍼 클래스의 구현을 필요에 따라서 호출할 뿐(만큼)인가,FilterBypass 를 필요에 따라서 직접 호출합니다.

파라미터:
fb - Document 의 변경에 사용하는 FilterBypass
offset - 선두로부터의 오프셋(offset) >= 0
length - 삭제 대상의 문자수 >= 0
예외:
BadLocationException - 삭제 범위의 일부가 문서의 유효한 부분이 아니었던 경우. 예외내의 위치는, 최초로 검출된 부정한 위치

insertString

public void insertString(DocumentFilter.FilterBypass  fb,
                         int offset,
                         String  string,
                         AttributeSet  attr)
                  throws BadLocationException 
지정한 Document 에 텍스트를 삽입하기 전에 불려 갑니다. 조건부로 삽입을 허가하는 서브 클래스는, 이 메소드를 오버라이드(override) 해 슈퍼 클래스의 구현을 필요에 따라서 호출할 뿐(만큼)인가, FilterBypass 를 필요에 따라서 직접 호출합니다.

파라미터:
fb - Document 의 변경에 사용하는 FilterBypass
offset - 컨텐츠를 삽입하는 문서내의 오프셋(offset). 0 이상. 지정 위치나 그 뒤의 변경을 추적한다 모든 위치가 이동
string - 삽입하는 캐릭터 라인
attr - 삽입된 컨텐츠에 관련짓는 속성. 속성이 없는 경우는 null 도 가능
예외:
BadLocationException - 지정된 삽입 위치가 문서내의 유효한 위치가 아닌 경우

replace

public void replace(DocumentFilter.FilterBypass  fb,
                    int offset,
                    int length,
                    String  text,
                    AttributeSet  attrs)
             throws BadLocationException 
지정한 Document 로 텍스트의 범위를 옮겨놓기 전에 불려 갑니다. 조건부로 치환을 허가하는 서브 클래스는, 이 메소드를 오버라이드(override) 해 슈퍼 클래스의 구현을 필요에 따라서 호출할 뿐(만큼)인가, FilterBypass 를 필요에 따라서 직접 호출합니다.

파라미터:
fb - Document 의 변경에 사용하는 FilterBypass
offset - Document 에서의 위치
length - 삭제하는 텍스트의 길이
text - 삽입하는 텍스트. null 의 경우, 텍스트는 삽입되지 않는
attrs - 삽입된 텍스트의 속성을 나타내는 AttributeSet. null 도 가능
예외:
BadLocationException - 지정된 삽입 위치가 문서내의 유효한 위치가 아닌 경우

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.