2013-09-30 2 views
0

특정 단어 또는 라인의 스타일 (즉, 글꼴, 색상 및 기타 속성)을 변경해야합니다.
나뿐만 JTextPane가 이것을 시도 :JEditorPane에서 텍스트 서식 지정

textPane.getStyledDocument().setCharacterAttributes(start,length,myTextStyle,false); 

JEditorPane의과 같은 일을 할 수있는 방법이 있습니까.
어떻게 단어를 형식화 할 수 있습니까? JEditorPane.

답변

3

캐스트를

((StyledDocument)editorPane.getDocument()).setCharacterAttributes(start,length,myTextStyle,false); 
1

마음, 명명 @이 작업을 수행하는 방법에 대한 좋은 설명이있다 "JEditorPane로는"오해의 소지가된다; JTextPaneJEditorPane의 하위 클래스입니다. 따라서 자신 만의 스타일 편집기를 만들고 싶다면 JTextPane을 사용하십시오. 스타일 문서에