import java.applet.*;
import java.awt.*;
public class game2 extends Applet implements Runnable {
int x_pos = 10;
int y_pos = 100;
int radius = 20;
public void init(){}
public void start()
{
//define a new thread
Thread th = new Thread (this);
}
public void stop(){}
public void destroy(){}
public void run()
{
// lower ThreadPriority
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
// run a long while(true) this means in this case "always"
while(true)
{
// changing the x - position of the ball/circle
x_pos ++;
// repaint the applet
repaint();
try{
// Stop thread for 20 milliseconds
Thread.sleep(20);
}
catch(InterruptedException ex)
{/* Do nothing*/}
//set ThreadPriority to maxium value
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
}
public void paint(Graphics g)
{
// set color
g.setColor(Color.red);
// paint the colored circle
g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
}
}
When I try to run this I get a message saying "Unable to start runtime due to incomplete configuration"?

New Topic/Question
This topic is locked



MultiQuote



|