Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package appletthread;
- import java.applet.Applet;
- import java.awt.Graphics;
- public class AppletThread
- {
- public static void main(String[] args)
- {
- }
- }
- class Chrono extends Applet implements Runnable
- {
- int heures;
- int minutes;
- int secondes;
- public void init()
- {
- this.heures = 0;
- this.minutes = 0;
- this.secondes = 0;
- Thread t = new Thread(this);
- t.start();
- }
- @Override
- public void run()
- {
- this.secondes++;
- if (this.secondes == 59)
- {
- this.minutes++;
- this.secondes = 0;
- }
- if (this.minutes == 59)
- {
- this.heures++;
- this.minutes = 0;
- }
- //throw new UnsupportedOperationException("Not supported yet.");
- }
- public void paint(Graphics g)
- {
- g.drawString(this.heures + ":" + this.minutes + ":" + this.secondes, WIDTH, WIDTH);
- }
- }
Add Comment
Please, Sign In to add comment