/**
* 编写一个Applet程序,要求能够在其中绘制图像。
* */
/**
* java课程设计第四次上机第五题
* @author renwenchao
* @version 31/5/2011
* */
/**
* 使用本程序需要注意,本程序必须配套的在程序的bin目录下(也就是程序的.class文件存放的位置)
* 放置一个名字为MM.jpg的图片
* 并且创建一个和类名一样的HTML文件,本程序配套的名字为:javaHomeWork4_5.html
* 相应的HTML的代码如下:
* */
/*
* <HTML>
<BODY>
<APPLET CODE=" javaHomeWork4_5.class" WIDTH="200" HEIGHT="200">
</APPLET>
</BODY>
</HTML>
*
* */
import java.awt.*;
import javax.swing.*;
public class javaHomeWork4_5 extends JApplet{
int imageHight;
int imageWidth;
Image image;
public void init(){
setSize(500,500);
setVisible(true);
image=getImage(getCodeBase(),"MM.jpg");
imageHight=image.getHeight(this);
imageWidth=image.getWidth(this);
}
public void paint(Graphics g){
g.drawImage(image, 0, 0, imageHight, imageWidth, this);
}
}