Download Free Apps & Games @ PHONEKY.com
Subject: java a moving ball program
Replies: 1 Views: 1038
samstarx 6.07.11 - 11:49am
import java.applet.*
clas* ball extends Applet implements Runnable
int x= 20; int y=20;
int radius = 20;
public void init()
Thread t = new Thread(this);
t.start;
public void run()
while(true)
x++;
repaint();
try
t.sleep(200);
catch(InterruptedException e)
public void paint(Graphics g)
g.setColor(Color,red);
g.fillOval(x-r,y-r,r*2,r*2);
*
samstarx 6.07.11 - 11:50am
curly braces are not visible'' surrounding the public methods and class
method body is visible. *