DefaultStyledDocument

DefaultStyledDocument (스타일 문서 기본 구현)

특성(attribute)과 스타일 런(style run)을 지원하는 문서의 기본 구현입니다. 스타일 런은 문단 요소 구조로 매핑됩니다.

출처: Java API Reference

본문

스타일 런은 논리적 스타일이 문단 경계에 지정되므로 문단 경계에서 나뉩니다.

중첩 클래스로 DefaultStyledDocument.AttributeUndoableEdit, ElementBuffer, ElementSpec, SectionElement가 있습니다. ElementSpec은 요소를 만드는 데 사용되는 명세이고, SectionElement는 문서의 기본 루트 요소로 문단/줄을 매핑합니다.

주요 메서드·상세 (Methods & details)

주요 메서드로는 특성을 설정·제거하는 setCharacterAttributes(int, int, AttributeSet, boolean)/setParagraphAttributes(int, int, AttributeSet, boolean), 요소를 얻는 getCharacterElement(int)/getParagraphElement(int), 스타일을 다루는 getStyle(String)/addStyle(String, Style), undo 이벤트를 다루는 addUndoableEditListener(UndoableEditListener) 등이 있습니다.

더 알아보기 (Learn more)

Java 공식 API