第6周作业-图像缩放显示1

import java.awt.*;
import javax.swing.*;

public class ShowImg extends JApplet
{
	Image img1;
	public void init()
	{
		img1 =getImage(getCodeBase(),"mao.jpg");
	}
	public void paint(Graphics g)
	{
		int w =img1.getWidth(this);
		int h =img1.getHeight(this);
		g.drawImage(img1, 5,10,this);
		g.drawImage(img1,150,40,w/2,h/2,this);
		g.drawImage(img1,5,100,w*2,h*2,this);
	}
}

你可能感兴趣的:(Java编程)