import java.awt.*;
import javax.swing.*;
public class ShowImg extends JApplet{
Image imgl;
public void init(){
imgl = getImage(getCodeBase(),"img1.gif");
}
public void paint(Graphics g){
int w = imgl.getWidth(this);
int h = imgl.getHeight(this);
g.drawImage(imgl,5,10,this);
g.drawImage(imgl,400,40,w/2,h/2,this);
g.drawImage(imgl,5,260,w*2,h*2,this);
}
}
运行结果: