0% found this document useful (0 votes)
14 views1 page

Java Applet Digital Clock Code

The document contains Java code for an applet named 'digi' that implements the Runnable interface. It creates a thread to update the display every second, showing the current hour, minute, and second in red. The applet is designed to be embedded in an HTML page with specified dimensions.

Uploaded by

dharunmanoj2111
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

Java Applet Digital Clock Code

The document contains Java code for an applet named 'digi' that implements the Runnable interface. It creates a thread to update the display every second, showing the current hour, minute, and second in red. The applet is designed to be embedded in an HTML page with specified dimensions.

Uploaded by

dharunmanoj2111
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import java.

awt;
import [Link];
import [Link];
public class digi extends applet implement runnable
{
thread t,t1;
public void start()
{
t=new thread (this);
t=start();
}
public void run()
{
t1=thread current thread();
while(t1==t)
{
repaint();
try
{
[Link](1000);
}
catch(interrupted exception e){}
}
}
public void paint(graphics g)
{
calender cal=new gregorian calender();
[Link] color([Link]);
string hour=[Link] of ([Link]([Link]));
string minute=[Link] of ([Link]([Link]));
string second=[Link] of ([Link]([Link]));
[Link] string(court":"+minute+"+second,100,100);
}
}

/*<applet code=digi
width=500
height=500>
</applet>*/

You might also like