2013-04-21 67 views
2

我一直在使用JEditorPane嘗試顯示CSS,但似乎沒有正確執行此操作。看看其他例子,它似乎應該是正確的,但似乎沒有正確渲染。從我所知道的情況來看,CSS和swing並不能很好地結合在一起。JEditorPane將一些樣式轉爲藍色

這就是我想現在做的事:

// 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.. 

沒有錯誤快到了,只是一個藍色的編輯窗格。以下是最初檢索的內容:http://runescape.wikia.com/index.php?diff=prev&oldid=7886038&diffonly=1&action=render

我應該嘗試更改樣式表,jeditorpane還是其他?

這裏究竟是什麼發生了清晰的圖片:

Blue JEditorPane

+1

'JEditorPane'是一件壞事...我曾經爲之奮鬥過,但我終於放棄了。 – johnchen902 2013-04-21 05:52:38

回答

0

你不應該使用的JEditorPane這一點。