appletimage.java
package appletusage;
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
public class appletimage extends Applet {
Image img1,img2;
@Override
public void init() {
img1 = getImage(getDocumentBase(), "one.png");
img2 = getImage(getDocumentBase(), "two.png");
}
@Override
public void paint(Graphics g){
//display an image using drwaImage method of Graphics class.
g.drawImage(img1, 0,0,this);
g.drawImage(img2, 0,300,this);
}
}
No comments:
Post a Comment