2009-09-17 3 views

답변

2

setText()에 HTML 콘텐츠와 함께 스타일 태그를 포함 할 수는 없습니까?

기본적 당

jEditorPane.setText("<html><head><style type=\"text/css\">...</style></head><body>..."); 
4

HTMLEditorKit는 파일 default.css을 찾습니다 - 그래도 난 어디 모르겠어요. 그러나

StyleSheet ss = new StyleSheet(); 
ss.importStyleSheet(styleSheetURL); 
HTMLEditorKit kit = (HTMLEditorKit)jEditorPane.getEditorKit(); 
kit.setStyleSheet(ss); 

을 그는 HTMLEditorKit 만 1

+2

편집기 키트가 실제로 것으로 나타나지 않는 (여러 편집기 창에서 공유되는 CSS의 limited subset 지원합니다 : 또는

이 작동합니다 API에서 언급했듯이 소스 코드를 읽으면 알게 될 것이다.) 따라서이 코드는 실제로 스타일을 지정하려는 것이 아닌 애플리케이션의 모든 JEditorPane을 변경한다. – Trejkaz

관련 문제