在JEditorPane中如何引入外部的CSS文件?????

westking 2003-10-17 02:51:46
我在使用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);
....
...全文
61 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧