1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
///.....
public void start() {
Thread t = new Thread(new Runnable() {
public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
repaint();
}
}
});
}
public void paint(Graphics g) {
URL urlofserver; // à initialiser en lui passant une URL correcte...
// Draw image
image = getImage(urlofserver, "webcam.jpg");
g.drawImage(image, 0, 0, this);
// image.flush(); // if i flush the image, nothing is shown on web page
}
} |
Partager