home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 57
/
Amiga_Dream_57.iso
/
Rubrique_Java
/
octobre
/
DemoBeans
/
Horloge.java
< prev
Wrap
Text File
|
1998-10-17
|
858b
|
35 lines
package DemoBeans;
import java.io.*;
import java.beans.*;
public class Horloge implements Serializable, Runnable {
private PropertyChangeListener pcl;
private PropertyChangeEvent evt;
private transient Thread horloge;
public void Horloge() {
start();
}
public void start() {
horloge=new Thread(this);
horloge.start();
}
public int getPeriod() { return 1; }
public void stop() { horloge.stop(); }
public void run() {
for(;;) {
try { horloge.sleep(1000); }
catch(Exception e) {}
pcl.propertyChange(evt);
}
}
public void addPropertyChangeListener(PropertyChangeListener l) {
evt=new PropertyChangeEvent(this, "TickHorloge", null, new Integer(1));
pcl=l;
}
public void removePropertyChangeListener(PropertyChangeListener l) {
pcl=null;
}
}