import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
import java.util.Enumeration;
import java.io.*;

class treeDisplayPane extends Panel implements MouseListener {

    private Frame frame;
    private int width, height;
    private displayTree tree;

    public treeDisplayPane(Frame superFrame, int w, int h, String inFile) {	
	this.frame = superFrame;
	this.width = w;
	this.height = h;
	
	try {
	    tree = new displayTree(new FileInputStream(inFile));
	} catch (FileNotFoundException e) {
	    System.err.println("intput file not found");
	    System.exit(0);
	} catch (IOException e) {
	    System.err.println("I/O Error?");
	    System.exit(0);
	}
	
	this.setSize(w,h);
	//init event handling
	//this.addMouseListener(this);

    }

    public Dimension getPreferredSize() { return new Dimension(width, height); }

    //--- redraw -----------------------
    public void paint(Graphics g) {
	Rectangle clip = g.getClipBounds();
	g.clearRect(clip.x, clip.y, clip.width, clip.height);
	tree.drawSelf(g);
    }

    //--- event handlers (mouse listener) ---------
    public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}
    public void mouseClicked(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}

    public void setNodeVisibility(int node, boolean vis) { tree.setNodeVisibility(node, vis); }
    public void nextTree() { tree.readStream(); }
}
