以URL.openStream()为输入流构造图片也可直接用URL构造图片 比如:URL u = new URL("http://webim.csdn.net/App_Themes/Default/Script/mz/Csdn/_resources/FrameMDI/group.gif"); Toolkit.getDefaultToolkit().getImage(u);
像这么写还是抛出 Unhandled exception type MalformedURLException 这个异常啊?
URL u = new URL("..."); Toolkit.getDefaultToolkit().getImage(u);
是啊,这样写还有Unhandled exception type MalformedURLException 这个异常啊~~~ 是怎么回事~?
以URL.openStream()为输入流构造图片也可直接用URL构造图片
比如:URL u = new URL("http://webim.csdn.net/App_Themes/Default/Script/mz/Csdn/_resources/FrameMDI/group.gif");
Toolkit.getDefaultToolkit().getImage(u);
Toolkit.getDefaultToolkit().getImage(u);
是怎么回事~?
url可能格式错误、所以必须处理MalformedURLException 异常要么catch 要么throws
Toolkit.getDefaultToolkit().getImage(u);
Graphics g=new Graphics();
g.drawImage(image, 0, 0,this);