Java Applet - Model Digital Clock Demo
This Program is used to demonstrate the Digital Clock Model Program using Java Applet.
// Thread Example
import java.awt.*;
import java.applet.*;
public class clock1 extends Applet implements Runnable
{
int i,j,k;
Thread t;
public void init()
{
t = new Thread(this);
t.start();
}
public void run()
{
try
{
while(true)
{
for(i=0;i<=12;i++)
{
for(j=0;j<=60;j++)
{
for(k=0;k<=60;k++)
{
repaint();
Thread.sleep(1000);
}
}
}
}
}
catch(Exception e)
{ }
}
public void paint(Graphics g)
{
String s = ""+i;
String s1 = ""+j;
String s2 = ""+k;
g.setFont(new Font("Arial",Font.BOLD,40));
g.drawString(s,100,100);
g.drawString(":",130,100);
g.drawString(s1,150,100);
g.drawString(":",170,100);
g.drawString(s2,190,100);
}
}
/*<applet code = "clock1.class" height =300 width=300>
</applet> */

