Animation in applet

Animation in applet

One of the uses of applets is in performing animation and devoloping games. Animation represents moving object from one place to another. To animate an object, we should first load it into image class object,
Image img = getImage(getDocumentBase(), ”image.jpg”);


import java.awt.*;
import java.applet.*;
public class test extends Applet
public void paint(Graphics g)
Image img = getImage(getDocumentBase(),”java1.jpg”);
for(int i=0;i<500;i++)
g.drawImage(img, i,30, this);
catch(Exception e){}


<applet code=”test.class” width=”600″ height=”800″>

Leave a Reply

Your email address will not be published. Required fields are marked *