package org.nzdl.gsdl.GsdlCollageApplet;

import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.geom.*;
import java.util.*;

/** 
 *  @author Katrina Edgar */
public class Display extends Thread {

    GsdlCollageApplet app_ = null;

     public Display(GsdlCollageApplet app) {
	super("Display");
	app_ = app;
	
    }


    /** Runs display thread by repeatedly calling the next frame,
     *  waiting for a specified delay period between calls */
    public void run() {
	try {

	    System.err.println("Started display thread.");

	    Thread curr_thread = Thread.currentThread();
	    
	    while (curr_thread == this) {
		app_.repaint();
		// can't make it zero or it hogs the whole processor
		Thread.sleep(100);
		curr_thread = Thread.currentThread();
	    }

	    System.err.println("Stopped display thread.");
	    
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }
}
