I've attached a minimal test case that shows the problem. Run the test code with the test.html file in the same directory as the JTextPaneTest.class file. I tried changing the JTextPane to a JEditorPane, but that fails also.

Regards,

Dave

David Gilbert wrote:
Hi Roman,

I was hopeful that this might improve the JFreeChart demo a little, because it displays an HTML description of the selected chart. With GNU Classpath, the description is currently displayed as plain text with visible HTML tags.

It turns out that with your patch, the chart description disappears entirely. It might be because the demo uses a JTextPane to display the description (JTextPane is a subclass of JEditorPane). I don't know how to fix this in GNU Classpath. Do you have time to look at the JTextPane class? If not, I'll file a bug so it isn't forgotten in the long run...

Regards,

Dave

Roman Kennke wrote:
This is an old patch that enables basic HTML loading from URLs in
JEditorPanes via setPage(URL).

2006-10-18  Roman Kennke  <[EMAIL PROTECTED]>

    * javax/swing/JEditorPane.java
    (page): Removed field. The page is now stored in the correct
    document property.
    (getPage): Fetch page URL from document property.
    (read): Set the document for this JEditorPane. Use a Reader
    for reading in the document.
    (setPage): Call getStream() to get the stream from which we read.
    Fire property change. Store page in document property.

/Roman





import java.awt.Dimension;
import java.io.IOException;
import java.net.URL;

import javax.swing.JFrame;
import javax.swing.JTextPane;

public class JTextPaneTest extends JFrame {

    public JTextPaneTest(String title) {
        super(title);
        JTextPane tp = new JTextPane();
        tp.setEditable(false);
        URL url = JTextPaneTest.class.getResource("test.html");
        try {
            tp.setPage(url);
        } 
        catch (IOException e) {
            e.printStackTrace();
        }
        setContentPane(tp);
    }
    public static void main(String[] args) {
        JTextPaneTest app = new JTextPaneTest("JTextPaneTest");
        app.setPreferredSize(new Dimension(600, 400));
        app.pack();
        app.setVisible(true);
    }
}
Hello World!

This is a JTextPane.

Reply via email to