一个在网上获取图片的java程序..
imag.java文件..
import java.applet.*;
import java.net.*;
import java.awt.*;
public class imag extends Applet
{
Image imag;
URL imgur=null;
public void init()
{
try{
imgur= new URL("http://img.poco.cn/photo/20060721/94378020220060721123628_3.jpg");
}
catch(MalformedURLException e)
{
System.out.println("Can´t open the URL");
}
imag=getImage(imgur);
}
public void paint(Graphics g){
g.drawImage(imag,0,0,this);
}
}
test.html文件:
<html>
<head>
<title>Example</title>
</head>
<center>
<applet code=imag.class width=550 height=230>
</applet>
</html>
编译javac imag.java,没有错误..
运行appletviewer test.html..怎么不显示网络上的图片...给出这些提示..
java.security.AccessControlException: access denied (java.net.SocketPermission img.poco.cn resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin.viewer.context.DefaultPluginAppletContext.getImage(Unknown Source)
at java.applet.Applet.getImage(Unknown Source)
at imag.init(imag.java:20)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
求大哥们给小弟点指导....该怎么做..
[求助]初学者菜鸟求助..错误在哪..