Hairr
Hairr

Reputation: 1108

JEditorPane turning some styles blue

I've been working with a JEditorPane, trying to display CSS, but it doesn't seem to correctly do so. Looking at other examples, it seems that it should be right, but doesn't seem to be rendering correctly. From what I know already, CSS and swing don't work... exactly well together.

This is what I'm trying to do currently:

// List variables...
public JEditorPane diff_view = new JEditorPane();
public static HTMLEditorKit kit = new HTMLEditorKit();
public static StyleSheet ss = kit.getStyleSheet();

public Frame() {
// Adding a list...
try {
    ss.importStyleSheet(new URL("http://slot1.wikia.com/load.php?debug=true&lang=en&"
                    + "modules=mediawiki.action.history.diff&only=styles"));
    } catch (MalformedURLException ex) { }
JScrollPane jsp2 = new JScrollPane(diff_view);
jsp2.setSize(909, 650);
jsp2.setLocation(153, 100);
diff_view.setContentType("text/html");
diff_view.setEditable(false);
diff_view.setLocation(153, 100);
diff_view.setSize(909, 650);
diff_view.setEditorKit(kit);
add(diff_view);
}
// Retrieving the pages..

No error is coming up, just a blue editor pane. Here is what initially retrieved: http://runescape.wikia.com/index.php?diff=prev&oldid=7886038&diffonly=1&action=render .

Should I try to change the stylesheet, the jeditorpane, or something else?

Here is a picture of what is happening exactly for clarity:

Blue JEditorPane

Upvotes: 2

Views: 273

Answers (2)

StanislavL
StanislavL

Reputation: 57421

JEditorPane has limited styles support. You can try instead e.g. https://code.google.com/p/flying-saucer/

Upvotes: 1

user2284052
user2284052

Reputation:

You should not be using jeditorpane for this.

Upvotes: 0

Related Questions