home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Container;
- import java.awt.Font;
- import java.awt.Label;
- import java.text.DateFormat;
- import java.util.Date;
- import java.util.TimeZone;
-
- public class WebClock extends Applet implements Runnable {
- private Label clock_label;
- private Thread tick_thread;
-
- public void init() {
- this.updateDateTime();
- }
-
- private void updateDateTime() {
- Date var1 = new Date();
- DateFormat var2 = DateFormat.getDateTimeInstance(0, 3);
- TimeZone var3 = TimeZone.getDefault();
- var2.setTimeZone(var3);
- String var4 = var2.format(var1);
- if (this.clock_label == null) {
- this.clock_label = new Label(var4, 1);
- this.clock_label.setFont(new Font("TimesRoman", 0, 24));
- ((Container)this).add(this.clock_label);
- } else {
- this.clock_label.setText(var4);
- }
- }
-
- public void start() {
- if (this.tick_thread == null) {
- this.tick_thread = new Thread(this);
- this.tick_thread.start();
- }
-
- }
-
- public void stop() {
- this.tick_thread = null;
- }
-
- public void run() {
- Thread var1 = Thread.currentThread();
- var1.setPriority(1);
-
- while(var1 == this.tick_thread) {
- this.updateDateTime();
-
- try {
- Thread.sleep(60000L);
- } catch (InterruptedException var2) {
- }
- }
-
- }
-
- public String getAppletInfo() {
- return Variables.program + " " + Variables.version + " " + Variables.copyright + " " + Variables.right;
- }
- }
-