hi all
Here i am trying to a code in which the run method is not being called when the thread is started..
Can anyone help me please..
Here is my code
import java.awt.*;
public class Games extends Frame implements Runnable
{
int x=250,y=470;
Thread t=new Thread();
Games()
{
setVisible(true);
setSize(500,500);
}
public void repeat()
{
System.out.println("repeat");
if(t==null)
{
t=new Thread();
}
System.out.println("repeat start");
t.start();
}
public void run()
{
System.out.println("run started");
while(true)
{
try
{
Thread.sleep(30);
System.out.println("hi");
}
catch(InterruptedException e)
{
repaint();
}
}
}
public void paint(Graphics g)
{
y+=6;
g.drawOval(x,y,30,30);
System.out.println("paint");
repeat();
}
public static void main(String args[])
{
new Games();
}
}
Thanks in advance