I. Introduction
II. Program
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
public class OnePicture extends Applet {
Image image;
public void init() {
image = getImage(getDocumentBase(), "Wave.jpg");
}
public void paint(Graphics g) {
g.drawImage(image, 50, 50, this);
}
}
III. The related applet
To view the applet using JDK viewer:
C:\Java>appletviewer OnePicture.html
|
Here is the applet:
Or write this HTML code and call it on a browser:
<HTML>
<HEAD>
<TITLE>One Picture</TITLE>
</HEAD>
<BODY>
<applet code=OnePicture.class width="300" height="200"> </applet>
</BODY>
</HTML>
One picture applet
|