Clock Applet Program!!

import java.applet.*;
import java.awt.*;
import java.util.*;

public class ClockApplet extends Applet implements Runnable{
 Thread t,t1;
 public void start(){
  t = new Thread(this);
 public void run(){
  t1 = Thread.currentThread();
  while(t1 == t){
   }catch(InterruptedException e){}

 public void paint(Graphics g){
  Calendar cal = new GregorianCalendar();
  String hour = String.valueOf(cal.get(Calendar.HOUR));
  String minute = String.valueOf(cal.get(Calendar.MINUTE));
  String second = String.valueOf(cal.get(Calendar.SECOND));
  g.drawString(hour + “:” + minute + “:” + second, 20, 30);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s