2013-04-05 2 views
0

html을 사용하여 JTextPane 영역의 아래쪽에 텍스트를 표시하려고했습니다. 이 스타일을 지원하지 않는 것, 나는 다음과 같은 코드를 사용 :JTextPane의 하단에 html 텍스트를 표시합니다.

<!-- saved from url=(0040)file:///C:/Users/tusim/Desktop/test.html --> 
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<style type="text/css"> 
table { font-family:"tahoma"; font-size:11; width: 100% 
} 
td, th { 
background-color: white} 
.header {font-weight:bold;} 
.record-first {font-weight:bold; min-width: 130px;} 
</style> 
</head> 
<body><table border="0" cellpadding="2" cellspacing="1" height="95%"><tbody><tr height="95%"><td width="32%" height="95%" valign="top"><div style="background-color: black; width: 100%;"><table border="0" cellpadding="2" cellspacing="1"> 
<tbody><tr class="header"> <td align="center">Col 1</td> </tr><tr><td>Val 1</td></tr></tbody></table></div></td><td></td><td width="32%" valign="top"><div style="background-color: black; width: 100%;"><table border="0" cellpadding="2" cellspacing="1"> 
<tbody><tr class="header"> <td align="center">Col 2</td> </tr><tr><td>Val 2</td></tr></tbody></table></div></td><td></td><td width="32%" valign="top"><div style="background-color: black; width: 100%;"><table border="0" cellpadding="2" cellspacing="1"> 
<tbody><tr class="header"> <td align="center">Col 3</td> </tr><tr><td>Val 3</td></tr></tbody></table></div></td></tr><tr height="5%" valign="bottom"><td colspan="5" valign="bottom">some text</td></tr></tbody></table></body></html> 

을하지만,하지만, 그렇지 JTextPane가에 브라우저에서 일하고있어. 누군가 나를 도울 수 있습니까?

미리 감사드립니다 ...

답변

1

JTextPane이 테이블을 지원합니까?

JTextPane를 사용하는 대신 JEditorPane을 사용하십시오. HTML 문서를 구문 분석 할 수있는 HTMLEditorKit이 있지만 HTML도 렌더링 할 수 있습니다.

다음은 예입니다 : 팁을위한

HTMLEditorKit kit = new HTMLEditorKit(); // Creates an instance 
editorPane.setEditorKit(kit); // Sets the Editor Kit 
+0

감사합니다. 그러나 HTMLEditorKit도 작동하지 않는 것 같습니다. 높이 매개 변수가 지원하지 않는 것 같습니다. – KTB

+0

오, 오케이. 미안하다. – user2228462

관련 문제