来源:http://blog.csdn.net/rexih/article/details/46461375
ImageIcon - javax.swing.*;
Image - java.awt.*;//Image 是表示图形图像的所有类的超类
在组件上画图,使用的是Graphics中的drawImage方法
1.需要有一个封装图像数据的Image对象:
Image img=new ImageIcon(String filename).getImage();
2.使用drawImage Graphics:
drawImage(Image img, int x, int y, ImageObserver observer) //绘制指定图像中当前可用的图像。最后一个参数可以用null
3.复制某块区域的图形到新位置
copyArea(int x, int y, int width, int height, int dx, int dy) //将组件的区域复制到由 dx 和 dy 指定的距离处。