import javax.swing.*;
import pal.tree.*;
import java.io.*;
import java.net.*;
import java.util.*;
import pal.misc.*;
import pal.distance.*;
 
public class TreeApp
	{

	public static void main(String[] args)
		{

		if(args.length!=1)
			{
			System.out.println("Usage : java TreeApp <inputfile>");
			System.exit(0);
			}
		String[] fileLines=TreeUtils.readStringFromFile(args[0]);
		PhyloNode root=TreeUtils.makeARootedNJTreeFromInputData(fileLines);

		String fName=new String(args[0]);

		TreeApp ta=new TreeApp(root,fName);
			
		}

	PhyloCanvas pc=null;
	JFrame myFrame=null;

	public TreeApp(PhyloNode root,String frameName)
		{
		PhyloCluster rootCluster=new PhyloCluster(root,null,null,true);
		//System.out.println(rootCluster.toString());
		//public PhyloCanvas(PhyloCluster root,double scale,double hval,double lval)
		pc=new PhyloCanvas(rootCluster,1.0,10,10000,true,null);
		pc.addMouseMotionListener(pc);
		pc.addMouseListener(pc);
		myFrame=new JFrame("Phylogenetic Tree Constructed from : "+frameName+".");
		myFrame.getContentPane().add(pc);
		myFrame.setSize(600,600);
		myFrame.setDefaultCloseOperation(myFrame.EXIT_ON_CLOSE);
		myFrame.setVisible(true);
		}
	}



