How do I insert a " " as-it-is into JTextPane(with "text/html" content-type)?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eric_Low
Posted On:   Sunday, August 4, 2002 01:54 AM

How do I insert a " " as-it-is into a JTextPane with content-type set to "text/html"?

Actually, my intention is to insert 1 or more " " into the JTextPane. The intended result should represent a space in HTML, instead of " ", obviously.



Any comment/help will be much appreciated!



Eric Low

Re: How do I insert a " " as-it-is into JTextPane(with "text/html" content-type)?

Posted By:   Mike_Friedrich  
Posted On:   Monday, August 5, 2002 12:58 AM

One way is this:

String linksource = " ";
HTMLDocument htdoc = (HTMLDocument)styledEditor.getDocument();
HTML.Tag insertTag = null;
editorKit.insertHTML( htdoc, styledEditor.getCaretPosition(),
linksource, 0, 0, insertTag);

A problem could be the null insertTag, i havn't tested this.


Regards, Mike

About | Sitemap | Contact