Moving an Object


public class plane extends Applet { private int x = 10; Image plane; public void init() {setSize(500,500); plane = getImage(getDocumentBase(), "plane.jpg"); } public void paint (Graphics g) {for (int x = 10;x <= 500; x++) {g.drawImage(plane,x,200,this); for ( int y =1; y <= 5000000;y++){}; // leave it on the screen g.setColor(Color.white); g.fillRect(x,200,x+50,250); // draw a white rectangle to erase it } }