// the code below moves a ball across the screen // first the init function sets the size of the applet window // then the paint function which is called automatically when the // applet opens up is called // the window name here is g - you named it as parametr to paint function // you are moving ball across the screen from 0 to 800 - jumping by 20 // fillOval fills a ball at x,y with size h,v // first we draw the ball in red- make the computer count a while // then draw it in white to erase it // we need to make computer count - this is the velocity - play with this number import java.awt.*; import javax.swing.*; public class BallBounce extends JApplet { public void init() {setSize(800,600); } public void paint (Graphics g) { for (int x=0; x <= 800; x+=20) {g.setColor(Color.red); g.fillOval(x,150,10,10); for (int y=1; y<=100000000;y++); g.setColor(Color.white); g.fillOval(x,150,10,10); } } }