在JEditorPane中如何引入外部的CSS文件?????
我在使用JEDITORPANE时,需要引入外部的CSS文件,可是引入后,不起作用,将所有的标签改为小写也不行,这是为什么,有经验的高手指点一下!!
代码如下:
....
HTMLEditorKit htmlKit = (HTMLEditorKit)jEditorPane1.getEditorKitForContentType("text/html");
HTMLDocument doc =(HTMLDocument)htmlKit.createDefaultDocument();
StyleSheet styles = new StyleSheet();
try{
styles.importStyleSheet(new URL("file:////E:/MySource/Style.css"));
}catch (Exception e){
System.out.println(e);
}
htmlKit.setStyleSheet(styles);
jEditorPane1.setEditorKit(htmlKit);
....