Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2005

Tip: Looking for answers? Try searching our database.

JTextPane problem

Thread view: 
A - 22 Nov 2005 18:40 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.