Methods Summary |
---|
public void | init()
String nextCell;
cells = new Vector();
theTracker = new MediaTracker(this);
for (int i = 0; (nextCell = getParameter("Cell" + i)) != null ; i++) {
Image img = getImage(getDocumentBase(), nextCell);
cells.addElement(img);
theTracker.addImage(img, i);
}
// start loading the images
theTracker.checkAll(true);
play = new Thread(this);
play.start();
running = true;
|
public boolean | mouseUp(java.awt.Event e, int x, int y)
if (running) {
play.suspend();
running = false;
}
else {
play.resume();
running = true;
}
return true;
|
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++) {
try {
// make sure this cell is loaded
theTracker.waitForID(thisCell);
// paint the cell
repaint();
// sleep for a tenth of a second
// i.e. play ten frames a second
play.sleep(100);
}
catch (InterruptedException ie) {
}
}
|
public void | start()
play.resume();
|
public void | stop()
play.suspend();
|