On Mar 16, 3:24 pm, "phillip.s.pow...@gmail.com"
<phillip.s.pow...@gmail.com> wrote:
On Mar 16, 12:23 pm, "phillip.s.pow...@gmail.com"
I did a much simpler version and here's the proof that you can't set
HTML into JEditorPane any other way except via setPage().
JDK 1.6.0 and XP
System.out.println(getURL()); // PRODUCES "http://www.cnn.com"
JEditorPane pane = new JEditorPane(getURL());
System.out.println(pane.getText());
You get this:
http://www.cnn.com
<html>
<head>
</head>
<body>
<p style="margin-top: 0">
</p>
</body>
</html>
And if you use this instead
browser.setText(html); // html IS THE VERIFIED HTML CONTENT OF
http://www.cnn.com
System.out.println(browser.getText()); // YOU GET NullPointerException
-------------------------------
But the moment you do this:
browser.setPage(new URL("http://www.cnn.com"));
Works perfectly, and appears to be the *only* option in Swing that
works for JEditorPane, which is very thread unsafe, unstable and
unmanageable.
Unless someone far smarter than I sees something I don't.
I played with it some and there is some issue with www.cnn.com. I don't
know what but other sites load just fine by using setText().