|
-
April 5th, 1999, 03:04 PM
#1
HTML displayed in a JTextPane
I'm trying to display an HTML, read in from a local file, in a JTextPane.
I'm trying not to use a file URL. In the following code, everything works
except I get a NullPointerException in the last line. I think the problem is
that the HTML is not being parsed properly. The file looks like this :
<HTML>
This is a test.
</HTML>
(In my application)
HTMLEditorKit htmlEditor = new HTMLEditorKit();
FileInputStream htmlStream = new FileInputStream ("test.html");
JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setEditorKit(htmlEditor);
htmlEditor.read(htmlStream, textPane.getDocument(),3);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|