Want help in implement this thread in java applet.
Hello friends,
I try to write a program for stop watch with the help of applet(not swing) and thread.
I completed to make the thread for this
check out this code
Any help will be appreciated.
I try to write a program for stop watch with the help of applet(not swing) and thread.
I completed to make the thread for this
check out this code
import java.awt.*;I want to implement this in applet.Please help me in doing this in applet.I completed this job in swing but unable to do this in applet.
import java.applet.*;
/*<APPLET CODE="r.class" HEIGHT=200 WIDTH=300></APPLET>*/
public class r
{
public static void display(int x)
{
String z=Integer.toString(x);
//return(z);
System.out.println(z);
}
//public void paint(Graphics g,String f)
//{
//g.drawString(f,20,40);
//}
public static void main(String args[])
{
r g=new r();
int x=0;
Thread t=new Thread();
t.start();
while(t!=null)
{
try
{
r.display(x);
//this.paint();
t.sleep(1000);
x++;
}
catch(InterruptedException e)
{
System.out.println("Thread interrupted ");
}
}
}
}
Any help will be appreciated.
0