FileDocCategorySizeDatePackage
Fractal3.javaAPI DocExample2238Thu Feb 04 16:10:38 GMT 1999None

Fractal

public class Fractal extends Applet implements Runnable

Fields Summary
Thread
t
boolean
shouldRun
Object
runLock
int
nSections
Constructors Summary
Methods Summary
voiddoCalc(int i)

		// calculate the ith section of the fractal
	
public voidpaint(java.awt.Graphics g)

		// Paint the completed sections of the fractal
	
public voidrun()

		for (int i = 0; i < nSections; i++) {
			doCalc(i);
			repaint();
			synchronized(runLock) {
				while (shouldRun == false)
					try {
						runLock.wait();
					} catch (InterruptedException ie) {}
			}
		}
	
public voidstart()


	   
		if (t == null) {
			shouldRun = true;	
			t = new Thread(this);
			t.setPriority(Thread.currentThread().getPriority() - 1);
			t.start();
		}
		else {
			synchronized(runLock) {
				shouldRun = true;
				runLock.notify();
			}
		}
	
public voidstop()

		shouldRun = false;