Hello
I using a JTextPane to display HTMLDocument.
I use setdocument followed by settext to switch between multiple html
documents. After the documents are displayed once, the style does not seem
to be applied at all when I switch to an htmldocument again. (which
displayed correctly the first time)
Please help.
thankyou
JTextPane j = new JTextPane();
j.setContentType("text/html");
j.setDocument(htmldoc);
j.setText(htmldoc.getText(0, htmldoc.getLength()));
....
eventHandler()
{
...
anotherhtmldoc = findHTMLDoc(filename);
j.setContentType("text/html");
j.setDocument(anotherhtmldoc);
j.setText(anotherhtmldoc.getText(0, anotherhtmldoc.getLength()));
....
}
HTMLDOC
==========
1.
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="style/style1.css" TYPE="text/css" MEDIA=screen>
</HEAD>
<BODY>
First HTML document
</BODY>
</HTML>
2.
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="style/style1.css" TYPE="text/css" MEDIA=screen>
</HEAD>
<BODY>
Second HTML document
</BODY>
</HTML>
Christian Kaufhold - 25 Nov 2005 00:33 GMT
> I using a JTextPane to display HTMLDocument.
> I use setdocument followed by settext to switch between multiple html
> documents. After the documents are displayed once, the style does not seem
> to be applied at all when I switch to an htmldocument again. (which
> displayed correctly the first time)
Why are you using setText at all?
Christian