Methods Summary |
---|
public void | init()
this.addMouseListener(this);
String nextCell;
MediaTracker theTracker = new MediaTracker(this);
for (int i = 0; (nextCell = this.getParameter("Cell" + i)) != null ; i++) {
Image img = this.getImage(this.getDocumentBase(), nextCell);
cells.addElement(img);
theTracker.addImage(img, i);
// start loading the image in a separate thread
theTracker.checkID(i, true);
}
// wait for all images to finish loading
try {
theTracker.waitForAll();
}
catch (InterruptedException e) {
}
|
public void | mouseClicked(java.awt.event.MouseEvent e)
if (running) {
this.stop();
}
else {
this.start();
}
|
public void | mouseEntered(java.awt.event.MouseEvent e)
|
public void | mouseExited(java.awt.event.MouseEvent e)
|
public void | mousePressed(java.awt.event.MouseEvent e)
|
public void | mouseReleased(java.awt.event.MouseEvent e)
|
public void | paint(java.awt.Graphics g)
g.drawImage((Image) cells.elementAt(thisCell), 0, 0, this);
|
public void | run()
for (thisCell=0; thisCell < cells.size(); thisCell++) {
if (!running) return;
// paint the cell
this.repaint();
// sleep for a tenth of a second
// i.e. play ten frames a second
try {
Thread.sleep(100);
}
catch (InterruptedException ie) {
}
}
|
public void | start()
this.running = true;
Thread play = new Thread(this);
play.start();
|
public void | stop()
this.running = false;
|