Hello,
I was wondering have HTML text behind a JTextPane, but inserting
information as StyledText. So, I used the HTMLEditorKit and StyledText
as below:
_logView = new JTextPane();
_logView.setEditorKit(new HTMLEditorKit());
_logViewDoc = _logView.getStyledDocument();
_logView.getCaret().setSelectionVisible(true);
setDocStyles(_logViewDoc);
try {
_logViewDoc.insertString(0,"TESTING;",_logViewDoc.getStyle("regular"));
_logViewDoc.insertString(_logViewDoc.getLength(),"COMMAND",_logViewDoc.getStyle("command"));
}catch(BadLocationException e) {}
The problem is that I need the HTML to print the document but when I try
to get it by using _logView.getText(); statement it returns the HTML
TAGs but doesn't return the text I inserted (see below). Am I doing
something wrong? Or maybe I am missing something?
<html>
<head>
<style type="text/css">
<!--
error { color: #ff0000 }
regular { font-size: 3; color: #000000; font-family: Courier }
command { color: #0000ff }
-->
</style>
</head>
<body>
<p>
<font color="#000000" face="Courier" size="3"><regular>
</font><font color="#0000ff"><command>
</font> </p>
Andrew Thompson - 14 Jan 2004 21:15 GMT
Please change your newsreader settings
to post to usenet forums in plain text _only_
Alexandre. While you are at it, set the line wrap
to no more than 75 chars..
The text size you use is so small I cannot read it.
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site