Would you like to react to this message? Create an account in a few clicks or log in to continue.

Thread Applet

Go down

 Thread  Applet Empty Thread Applet

ตั้งหัวข้อ  Admin Tue May 27, 2008 2:01 pm


package thread;

import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

public class Counter extends Applet implements Runnable {

int count=0;

public void init() {

setFont(new Font("Angsana NEW", Font.PLAIN,29));
setForeground(Color.red);
new Thread(this).start();
// ͧǹ
new Thread().start(); Դâ

}
public void paint(Graphics g) {
g.drawString(String.valueOf(count), 20, 20);
}

public void run() {

for(;count <= 60 ;count++){
try{
Thread.sleep(1000);
}catch (Exception e) { }
repaint();
}
}

public void stop() {
count = 1000;
}

}

Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน

- Similar topics

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ