Yurttas/PL/OOL/Java/F/07/02/A/A00.java

From ZCubes Wiki
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 1998
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : January 1, 1998.
11 *  @author : Salih Yurttas.
12 */
13
14
15import java.applet.*;
16
17import java.awt.*;
18
19public class A00 extends Applet
20                 implements Runnable {
21
22  Thread t;
23  int count;
24
25  public void init() {
26    count = 0;
27    t = new Thread(this);
28    t.start();
29  }
30
31  public boolean mouseDown(Event e,
32                           int x,
33                           int y) {
34    t.stop();
35    return true;
36  }
37
38  public void run() {
39    while(true) {
40      count++;
41      repaint();
42      try {
43        t.sleep(10);
44      }
45      catch(InterruptedException iE) {}
46    }
47  }
48
49  public void paint(Graphics g) {
50    g.drawString(Integer.toString(count),10,10);
51  }
52
53  public void stop() {
54    t.stop();
55  }
56
57}