editorPane= new JEditorPane();
URLClassLoader urlLoader = (URLClassLoader)this.getClass().getClassLoader();
URL url = urlLoader.findResource("doc/help.htm");
editorPane.setEditable(false);
// editorPane.setPage(url);
try {
editorPane.setPage(url);
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
this.add(editorPane,"East");
pack();
setVisible(true);报错,java.io.IOException: invalid url
at javax.swing.JEditorPane.setPage(Unknown Source)
at org.test.ImageFrame.<init>(ImageFrame.java:38)
at org.test.ImageFrame.main(ImageFrame.java:56)
URLClassLoader urlLoader = (URLClassLoader)this.getClass().getClassLoader();
URL url = urlLoader.findResource("doc/help.htm");
editorPane.setEditable(false);
// editorPane.setPage(url);
try {
editorPane.setPage(url);
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
this.add(editorPane,"East");
pack();
setVisible(true);报错,java.io.IOException: invalid url
at javax.swing.JEditorPane.setPage(Unknown Source)
at org.test.ImageFrame.<init>(ImageFrame.java:38)
at org.test.ImageFrame.main(ImageFrame.java:56)
你的代码本身就没什么问题,我在你原有代码上补完的一个
http://pickup.mofile.com/2097222747609172
下载连接你仔细找...广告把下载地址淹没了...不好意思
文件共享实在不好找...
public void mouseClicked(java.awt.event.MouseEvent evt) {
//事件处理代码...
}
});
你的"背景图片"指的是什么?谁的?我不明白