如何将一个图片画到一个已经存在java.awt.Graphics2D 对象中?小弟初学,请指点迷津 drawImage(getImage(getCodeBase(),"test.jpg"), 100, 100,this) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这就是我想要的:getImage(getCodeBase(),"test.jpg"),getImage()这个方法怎么实现的?请指点? 找到拉:在 Applet 里public Image getImage(URL url, String name) { try { return getImage(new URL(url, name)); } catch (MalformedURLException e) { return null; }}public Image getImage(URL url) { return getAppletContext().getImage(url);}public AppletContext getAppletContext() { return stub.getAppletContext();}接口里:AppletContext getAppletContext();具体怎么回事我也不知道,你自己再看看 两种最简单的方法:1.用javax.swing.ImageIcon类用ImageIcon ii=new ImageIcon("文件的路径");ii.getImage()就是你要的Image对象.2.用javax.imageio.ImageIO类BufferedImage bi=ImageIO.read("文件路径");bi就是你要的Image对象 记录socket问题 新手求助! 内部类的私有数据成员怎么可以被访问?? 请问这样的类继承方法对吗?急 关于内存中类对象与类对象引用的分配 我的JTree响应无效!? 如何带参数的调用main() 作为一个程序员技术、素质上的要求? java字符串查找与替换 關於通過JFileChooser在遠端服務器選擇本地文件夾的問題 谁来就就我这奇怪的程序,很简单 谁有bruceeckel的类库包?
在 Applet 里public Image getImage(URL url, String name) {
try {
return getImage(new URL(url, name));
} catch (MalformedURLException e) {
return null;
}
}
public Image getImage(URL url) {
return getAppletContext().getImage(url);
}public AppletContext getAppletContext() {
return stub.getAppletContext();
}接口里:AppletContext getAppletContext();具体怎么回事我也不知道,你自己再看看
1.用javax.swing.ImageIcon类
用ImageIcon ii=new ImageIcon("文件的路径");
ii.getImage()就是你要的Image对象.2.用javax.imageio.ImageIO类
BufferedImage bi=ImageIO.read("文件路径");
bi就是你要的Image对象